Modify ↓
#12940 closed defect (fixed)
Suggestion is rendered without html escaping
Reported by: | Jun Omae | Owned by: | Peter Suter |
---|---|---|---|
Priority: | normal | Component: | WikiAutoCompletePlugin |
Severity: | normal | Keywords: | |
Cc: | Trac Release: | 1.0 |
Description
We should use function to escape to template
option rather than default template
function.
$ git grep '\<template\>' -- src src/dropdown.js: html += datum.strategy.template(datum.value, datum.term); src/strategy.js: template: function (obj) { return obj; },
-
wikiautocomplete/htdocs/js/wikiautocomplete.js
diff --git a/wikiautocomplete/htdocs/js/wikiautocomplete.js b/wikiautocomplete/htdocs/js/wikiautocomplete.js index dac2c4c..0931b4a 100644
a b jQuery(document).ready(function($) { 3 3 return value.replace(/\$/g, '$$$$'); 4 4 } 5 5 6 function template(text, term) { 7 return $.htmlEscape(text); 8 } 9 6 10 $('textarea.wikitext').textcomplete([ 7 11 { // Attachment 8 12 match: /\b((?:raw-)?attachment):(\S*)$/, … … jQuery(document).ready(function($) { 14 18 .fail(function () { callback([]); }); 15 19 }, 16 20 index: 2, 21 template: template, 17 22 replace: function (name) { 18 23 if (/\s/.test(name)) 19 24 name = '"' + name + '"'; … … jQuery(document).ready(function($) { 30 35 .fail(function () { callback([]); }); 31 36 }, 32 37 index: 2, 38 template: template, 33 39 replace: function (resolver) { 34 40 return ['$1[' + escape_newvalue(resolver) + ':', ']']; 35 41 }, … … jQuery(document).ready(function($) { 45 51 }, 46 52 index: 1, 47 53 template: function (ticket) { 48 return '#' + ticket.id + ' ' + ticket.summary;54 return $.htmlEscape('#' + ticket.id + ' ' + ticket.summary); 49 55 }, 50 56 replace: function (ticket) { 51 57 return '#' + ticket.id; … … jQuery(document).ready(function($) { 61 67 .fail(function () { callback([]); }); 62 68 }, 63 69 index: 1, 70 template: template, 64 71 replace: function (wikipage) { 65 72 return 'wiki:' + escape_newvalue(wikipage); 66 73 }, … … jQuery(document).ready(function($) { 92 99 .fail(function () { callback([]); }); 93 100 }, 94 101 index: 2, 102 template: template, 95 103 replace: function (path) { 96 104 return '$1' + escape_newvalue(path); 97 105 },
Attachments (1)
Change History (3)
Changed 8 years ago by
Attachment: | no-html-escaping.png added |
---|
comment:1 Changed 8 years ago by
Note: See
TracTickets for help on using
tickets.
Sounds good, thanks.