proper escaping of file attributes in js templates
authorMaciej Tronowski <mtro@man.poznan.pl>
Wed, 2 Sep 2015 10:45:52 +0000 (12:45 +0200)
committerDawid Jagieła <lightnir@gmail.com>
Sat, 12 Sep 2015 10:08:10 +0000 (12:08 +0200)
filex/static/filex/filex.js
filex/templates/filex/source.js.html
filex/templates/filex/upload.js.html

index 011f47c..9f34b5e 100644 (file)
@@ -234,7 +234,7 @@ $(function(){
 
             // used in selectize callbacks
             var view = this,
-                optionTemplate = _.template('<div><div><%= host %></div><div class="small text-muted"><%= path %></div></div>');
+                optionTemplate = _.template('<div><div><%- host %></div><div class="small text-muted"><%- path %></div></div>');
 
             this.$('#host-selector').selectize({
                 optgroupField: 'group',
index 9457298..451d270 100644 (file)
 
 <script type="text/template" id="dir-template">
     <td class="text-center">
-        <label for="dir-<%= cid %>" class="sr-only">Zaznacz katalog <%= name %></label>
-        <input id="dir-<%= cid %>" type="checkbox" autocomplete="off">
+        <label for="dir-<%- cid %>" class="sr-only">Zaznacz katalog <%- name %></label>
+        <input id="dir-<%- cid %>" type="checkbox" autocomplete="off">
     </td>
     <td class="text-center"><span class="glyphicon glyphicon-folder-open" aria-hidden="true"></span></td>
-    <td><a class="link" href="#<%= url %>"><%= name %></a></td>
-    <td class="text-right"><%= size %></td>
-    <td><%= date %></td>
+    <td><a class="link" href="#<%- url %>"><%- name %></a></td>
+    <td class="text-right"><%- size %></td>
+    <td><%- date %></td>
 </script>
 
 <script type="text/template" id="file-template">
     <td class="text-center">
-        <label for="file-<%= cid %>" class="sr-only">Zaznacz plik <%= name %></label>
-        <input id="file-<%= cid %>" type="checkbox" autocomplete="off">
+        <label for="file-<%- cid %>" class="sr-only">Zaznacz plik <%- name %></label>
+        <input id="file-<%- cid %>" type="checkbox" autocomplete="off">
     </td>
     <td class="text-center"><span class="glyphicon glyphicon-file" aria-hidden="true"></span></td>
     <td>
-        <a class="link" href="{% url 'filex:download' %}?<%= params %>"><%= name %></a>
+        <a class="link" href="{% url 'filex:download' %}?<%- params %>"><%- name %></a>
     </td>
-    <td class="text-right"><%= size %></td>
-    <td><%= date %></td>
+    <td class="text-right"><%- size %></td>
+    <td><%- date %></td>
 </script>
index 3f1f786..cefe181 100644 (file)
 <script type="text/template" id="template">
     <div class="item">
         <div class="text clearfix">
-            <span class="name"><%= name %></span>
+            <span class="name"><%- name %></span>
             <span class="status pull-right">
                 <em class="small bit-rate" style="margin-right: 15px"></em>
                 <span class="text-muted progress-info">Oczekiwanie</span>
         </div>
 
         <div class="progress">
-            <div class="progress-bar" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="<%= size %>" style="width: 0;">
+            <div class="progress-bar" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="<%- size %>" style="width: 0;">
                 <span class="sr-only">0%</span>
             </div>
         </div>
 </script>
 
 <script type="text/template" id="conflict-template">
-    <h4>W wybranej lokalizacji plik o nazwie <em><%= name %></em> już istnieje!</h4>
+    <h4>W wybranej lokalizacji plik o nazwie <em><%- name %></em> już istnieje!</h4>
 
     <table class="table">
         <thead>
         <tbody>
             <tr>
                 <th scope="row">Data modyfikacji</th>
-                <td><%= srcDate.format('D MMM YYYY, h:mm') %></td>
-                <td><%= dstDate.format('D MMM YYYY, h:mm') %></td>
+                <td><%- srcDate.format('D MMM YYYY, h:mm') %></td>
+                <td><%- dstDate.format('D MMM YYYY, h:mm') %></td>
             </tr>
             <tr>
                 <th scope="row">Rozmiar</th>
-                <td><%= srcSize %></td>
-                <td><%= dstSize %></td>
+                <td><%- srcSize %></td>
+                <td><%- dstSize %></td>
             </tr>
         </tbody>
     </table>