@@ -6,6 +6,7 @@ import './publicpath.js';
66import './polyfills.js' ;
77
88import Vue from 'vue' ;
9+ import { htmlEscape } from 'escape-goat' ;
910import 'jquery.are-you-sure' ;
1011import './vendor/semanticdropdown.js' ;
1112import { svg } from './utils.js' ;
@@ -25,10 +26,6 @@ import {createCodeEditor} from './features/codeeditor.js';
2526
2627const { AppSubUrl, StaticUrlPrefix, csrf} = window . config ;
2728
28- function htmlEncode ( text ) {
29- return jQuery ( '<div />' ) . text ( text ) . html ( ) ;
30- }
31-
3229let previewFileModes ;
3330const commentMDEditors = { } ;
3431
@@ -532,12 +529,12 @@ function initCommentForm() {
532529 switch ( input_id ) {
533530 case '#milestone_id' :
534531 $list . find ( '.selected' ) . html ( `<a class="item" href=${ $ ( this ) . data ( 'href' ) } >${
535- htmlEncode ( $ ( this ) . text ( ) ) } </a>`) ;
532+ htmlEscape ( $ ( this ) . text ( ) ) } </a>`) ;
536533 break ;
537534 case '#assignee_id' :
538535 $list . find ( '.selected' ) . html ( `<a class="item" href=${ $ ( this ) . data ( 'href' ) } >` +
539536 `<img class="ui avatar image" src=${ $ ( this ) . data ( 'avatar' ) } >${
540- htmlEncode ( $ ( this ) . text ( ) ) } </a>`) ;
537+ htmlEscape ( $ ( this ) . text ( ) ) } </a>`) ;
541538 }
542539 $ ( `.ui${ select_id } .list .no-select` ) . addClass ( 'hide' ) ;
543540 $ ( input_id ) . val ( $ ( this ) . data ( 'id' ) ) ;
@@ -1942,7 +1939,7 @@ function searchUsers() {
19421939 $ . each ( response . data , ( _i , item ) => {
19431940 let title = item . login ;
19441941 if ( item . full_name && item . full_name . length > 0 ) {
1945- title += ` (${ htmlEncode ( item . full_name ) } )` ;
1942+ title += ` (${ htmlEscape ( item . full_name ) } )` ;
19461943 }
19471944 items . push ( {
19481945 title,
@@ -2223,7 +2220,7 @@ function initTemplateSearch() {
22232220 // Parse the response from the api to work with our dropdown
22242221 $ . each ( response . data , ( _r , repo ) => {
22252222 filteredResponse . results . push ( {
2226- name : htmlEncode ( repo . full_name ) ,
2223+ name : htmlEscape ( repo . full_name ) ,
22272224 value : repo . id
22282225 } ) ;
22292226 } ) ;
@@ -3500,8 +3497,8 @@ function initIssueList() {
35003497 return ;
35013498 }
35023499 filteredResponse . results . push ( {
3503- name : `#${ issue . number } ${ htmlEncode ( issue . title )
3504- } <div class="text small dont-break-out">${ htmlEncode ( issue . repository . full_name ) } </div>`,
3500+ name : `#${ issue . number } ${ htmlEscape ( issue . title )
3501+ } <div class="text small dont-break-out">${ htmlEscape ( issue . repository . full_name ) } </div>`,
35053502 value : issue . id
35063503 } ) ;
35073504 } ) ;
0 commit comments