Quellcode durchsuchen

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 vor 9 Jahren
Ursprung
Commit
69b15ae54f
1 geänderte Dateien mit 6 neuen und 1 gelöschten Zeilen
  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!')}")
   });
 
+  // Initial htmlEscape
+  String.prototype.htmlEscape = function() {
+    return $('<div/>').text(this.toString()).html();
+  };
+
   var dataTable = null;
   function cleanResultsTable() {
     if (dataTable) {
@@ -858,7 +863,7 @@ ${ commonshare() | n,unicode }
           ordered_row.push(index + row_index + 1);
         }
         else {
-          ordered_row.push(row[col]);
+          ordered_row.push(row[col]).toString().htmlEscape();
         }
       });
       dataTable.fnAddData(ordered_row);