Fixed: Html encode file upload errors

This commit is contained in:
Lucas Bartholemy 2015-11-18 21:51:13 +01:00
parent 270b8b4516
commit c4a8cbbb78
2 changed files with 10 additions and 2 deletions

View File

@ -324,7 +324,15 @@ $.fn.format = function (options) {
}
function htmlEncode(value) {
//create a in-memory div, set it's inner text(which jQuery automatically encodes)
//then grab the encoded contents back out. The div never exists on the page.
return $('<div/>').text(value).html();
}
function htmlDecode(value) {
return $('<div/>').html(value).text();
}

View File

@ -85,7 +85,7 @@ function showFileUploadError(file) {
'<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>' +
'<h4 class="modal-title" id="myModalLabel">' + fileuploader_error_modal_title + '</h4> ' +
'</div>' +
'<div class="modal-body text-center">' + fileuploader_error_modal_errormsg + ' ' + file.name + '<br>' + errorMessage + '</div>' +
'<div class="modal-body text-center">' + fileuploader_error_modal_errormsg + ' ' + htmlEncode(file.name) + '<br>' + htmlEncode(errorMessage) + '</div>' +
'<div class="modal-footer">' +
'<button type="button" class="btn btn-primary" data-dismiss="modal">' + fileuploader_error_modal_btn_close + '</button>' +
'</div>' +