Procházet zdrojové kódy

PR378 [rdbms] Result escape for XML xml

https://github.com/cloudera/hue/pull/378

modify row[col] add htmlEscape the data for XML data
rainysia před 9 roky
rodič
revize
69b15ae54f
1 změnil soubory, kde provedl 6 přidání a 1 odebrání
  1. 6 1
      apps/rdbms/src/rdbms/templates/execute.mako

+ 6 - 1
apps/rdbms/src/rdbms/templates/execute.mako

@@ -834,6 +834,11 @@ ${ commonshare() | n,unicode }
     $.jHueNotify.info("${_('Query saved successfully!')}")
     $.jHueNotify.info("${_('Query saved successfully!')}")
   });
   });
 
 
+  // Initial htmlEscape
+  String.prototype.htmlEscape = function() {
+    return $('<div/>').text(this.toString()).html();
+  };
+
   var dataTable = null;
   var dataTable = null;
   function cleanResultsTable() {
   function cleanResultsTable() {
     if (dataTable) {
     if (dataTable) {
@@ -858,7 +863,7 @@ ${ commonshare() | n,unicode }
           ordered_row.push(index + row_index + 1);
           ordered_row.push(index + row_index + 1);
         }
         }
         else {
         else {
-          ordered_row.push(row[col]);
+          ordered_row.push(row[col]).toString().htmlEscape();
         }
         }
       });
       });
       dataTable.fnAddData(ordered_row);
       dataTable.fnAddData(ordered_row);