fix(cloudfunc) encodeEntities: add "<", ">"

This commit is contained in:
coderaiser 2014-12-29 06:49:54 -05:00
parent 28f0283cab
commit a586640e8d

View file

@ -34,8 +34,13 @@ var Util;
this.CHANNEL_TERMINAL_RESIZE= 'terminal-resize';
this.MAX_FILE_SIZE = 500 * 1024;
function encodeSpace(str) {
return str.replace(/\s/g, '&nbsp;');
function encodeEntities(str) {
str = str
.replace(/\s/g, '&nbsp;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;');
return str;
}
this.formatMsg = function(msg, name, status) {
@ -227,7 +232,7 @@ var Util;
linkResult = render(templateLink, {
link : link,
name : encodeSpace(file.name),
name : encodeEntities(file.name),
attribute : attribute
});