Просмотр исходного кода

fix: form dropdown, escape autocomplete dropdown items, fixes #9089

Torkel Ödegaard 8 лет назад
Родитель
Сommit
bf110d02d1

+ 3 - 1
public/app/core/components/form_dropdown/form_dropdown.ts

@@ -115,7 +115,9 @@ export class FormDropdownCtrl {
       this.optionCache = options;
 
       // extract texts
-      let optionTexts = _.map(options, 'text');
+      let optionTexts = _.map(options, op => {
+        return _.escape(op.text);
+      });
 
       // add custom values
       if (this.allowCustom) {

+ 1 - 1
public/app/plugins/datasource/elasticsearch/query_def.js

@@ -29,7 +29,7 @@ function (_) {
 
     orderByOptions: [
       {text: "Doc Count",  value: '_count' },
-      {text: "Term value", value: '_term' },
+      {text: "Term value<script>alert('hello')</script>", value: '_term' },
     ],
 
     orderOptions: [