|
1 | 1 | 'use strict';
|
2 | 2 |
|
| 3 | +function htmlEncode(text) { |
| 4 | + return jQuery('<div />').text(text).html() |
| 5 | +} |
| 6 | + |
3 | 7 | var csrf;
|
4 | 8 | var suburl;
|
5 | 9 |
|
@@ -312,12 +316,12 @@ function initCommentForm() {
|
312 | 316 | switch (input_id) {
|
313 | 317 | case '#milestone_id':
|
314 | 318 | $list.find('.selected').html('<a class="item" href=' + $(this).data('href') + '>' +
|
315 |
| - $(this).text() + '</a>'); |
| 319 | + htmlEncode($(this).text()) + '</a>'); |
316 | 320 | break;
|
317 | 321 | case '#assignee_id':
|
318 | 322 | $list.find('.selected').html('<a class="item" href=' + $(this).data('href') + '>' +
|
319 | 323 | '<img class="ui avatar image" src=' + $(this).data('avatar') + '>' +
|
320 |
| - $(this).text() + '</a>'); |
| 324 | + htmlEncode($(this).text()) + '</a>'); |
321 | 325 | }
|
322 | 326 | $('.ui' + select_id + '.list .no-select').addClass('hide');
|
323 | 327 | $(input_id).val($(this).data('id'));
|
@@ -1456,7 +1460,7 @@ function searchUsers() {
|
1456 | 1460 | $.each(response.data, function (i, item) {
|
1457 | 1461 | var title = item.login;
|
1458 | 1462 | if (item.full_name && item.full_name.length > 0) {
|
1459 |
| - title += ' (' + item.full_name + ')'; |
| 1463 | + title += ' (' + htmlEncode(item.full_name) + ')'; |
1460 | 1464 | }
|
1461 | 1465 | items.push({
|
1462 | 1466 | title: title,
|
@@ -2510,7 +2514,7 @@ function initTopicbar() {
|
2510 | 2514 | if (res.topics) {
|
2511 | 2515 | formattedResponse.success = true;
|
2512 | 2516 | for (var i=0;i < res.topics.length;i++) {
|
2513 |
| - formattedResponse.results.push({"description": res.topics[i].Name, "data-value":res.topics[i].Name}) |
| 2517 | + formattedResponse.results.push({"description": res.topics[i].Name, "data-value": res.topics[i].Name}) |
2514 | 2518 | }
|
2515 | 2519 | }
|
2516 | 2520 |
|
@@ -2631,7 +2635,7 @@ function initIssueList() {
|
2631 | 2635 | // Parse the response from the api to work with our dropdown
|
2632 | 2636 | $.each(response, function(index, issue) {
|
2633 | 2637 | filteredResponse.results.push({
|
2634 |
| - 'name' : '#' + issue.number + ' ' + issue.title, |
| 2638 | + 'name' : '#' + issue.number + ' ' + htmlEncode(issue.title), |
2635 | 2639 | 'value' : issue.id
|
2636 | 2640 | });
|
2637 | 2641 | });
|
|
0 commit comments