fix xss code

This commit is contained in:
kekee000
2017-06-13 15:54:20 +08:00
parent 0e4e8624e9
commit 499bb78aeb
2 changed files with 4 additions and 4 deletions

View File

@@ -6,7 +6,7 @@
define(
function (require) {
var i18n = require('../i18n/i18n');
var string = require('common/string');
/**
* 项目列表查看器
*
@@ -73,8 +73,8 @@ define(
ProjectViewer.prototype.show = function (projects, selectedId) {
var str = '';
(projects || []).forEach(function (proj) {
str += '<dl data-id="' + proj.id + '">'
+ '<dt>' + proj.name + '</dt>'
str += '<dl data-id="' + string.encodeHTML(proj.id) + '">'
+ '<dt>' + string.encodeHTML(proj.name) + '</dt>'
+ '<dd>'
+ (proj.config && proj.config.sync
? ('<span data-action="sync" title="'

View File

@@ -45,7 +45,7 @@ define(
unicode: (glyf.unicode || []).map(function (u) {
return '$' + u.toString(16).toUpperCase();
}).join(','),
name: glyf.name,
name: string.encodeHTML(glyf.name || ''),
fillColor: opt.color ? 'style="fill:' + opt.color + '"' : ''
};