@@ -6,6 +6,7 @@ import './publicpath.js';
6
6
import './polyfills.js' ;
7
7
8
8
import Vue from 'vue' ;
9
+ import { htmlEscape } from 'escape-goat' ;
9
10
import 'jquery.are-you-sure' ;
10
11
import './vendor/semanticdropdown.js' ;
11
12
import { svg } from './utils.js' ;
@@ -25,10 +26,6 @@ import {createCodeEditor} from './features/codeeditor.js';
25
26
26
27
const { AppSubUrl, StaticUrlPrefix, csrf} = window . config ;
27
28
28
- function htmlEncode ( text ) {
29
- return jQuery ( '<div />' ) . text ( text ) . html ( ) ;
30
- }
31
-
32
29
let previewFileModes ;
33
30
const commentMDEditors = { } ;
34
31
@@ -532,12 +529,12 @@ function initCommentForm() {
532
529
switch ( input_id ) {
533
530
case '#milestone_id' :
534
531
$list . find ( '.selected' ) . html ( `<a class="item" href=${ $ ( this ) . data ( 'href' ) } >${
535
- htmlEncode ( $ ( this ) . text ( ) ) } </a>`) ;
532
+ htmlEscape ( $ ( this ) . text ( ) ) } </a>`) ;
536
533
break ;
537
534
case '#assignee_id' :
538
535
$list . find ( '.selected' ) . html ( `<a class="item" href=${ $ ( this ) . data ( 'href' ) } >` +
539
536
`<img class="ui avatar image" src=${ $ ( this ) . data ( 'avatar' ) } >${
540
- htmlEncode ( $ ( this ) . text ( ) ) } </a>`) ;
537
+ htmlEscape ( $ ( this ) . text ( ) ) } </a>`) ;
541
538
}
542
539
$ ( `.ui${ select_id } .list .no-select` ) . addClass ( 'hide' ) ;
543
540
$ ( input_id ) . val ( $ ( this ) . data ( 'id' ) ) ;
@@ -1942,7 +1939,7 @@ function searchUsers() {
1942
1939
$ . each ( response . data , ( _i , item ) => {
1943
1940
let title = item . login ;
1944
1941
if ( item . full_name && item . full_name . length > 0 ) {
1945
- title += ` (${ htmlEncode ( item . full_name ) } )` ;
1942
+ title += ` (${ htmlEscape ( item . full_name ) } )` ;
1946
1943
}
1947
1944
items . push ( {
1948
1945
title,
@@ -2223,7 +2220,7 @@ function initTemplateSearch() {
2223
2220
// Parse the response from the api to work with our dropdown
2224
2221
$ . each ( response . data , ( _r , repo ) => {
2225
2222
filteredResponse . results . push ( {
2226
- name : htmlEncode ( repo . full_name ) ,
2223
+ name : htmlEscape ( repo . full_name ) ,
2227
2224
value : repo . id
2228
2225
} ) ;
2229
2226
} ) ;
@@ -3500,8 +3497,8 @@ function initIssueList() {
3500
3497
return ;
3501
3498
}
3502
3499
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>`,
3505
3502
value : issue . id
3506
3503
} ) ;
3507
3504
} ) ;
0 commit comments