avoid passing HTML strings to alert

pull/1/head
ansuz 3 years ago
parent d45bb33537
commit fa0240976e

@ -2893,7 +2893,8 @@ define([
var onCreated = function (err, info) { var onCreated = function (err, info) {
if (err) { if (err) {
if (err === E_OVER_LIMIT) { if (err === E_OVER_LIMIT) {
return void UI.alert(Messages.pinLimitDrive, null, true); var content = h('span', UIElements.fixInlineBRs(Messages.pinLimitDrive));
return void UI.alert(content);
} }
return void UI.alert(Messages.fm_error_cantPin); return void UI.alert(Messages.fm_error_cantPin);
} }
@ -4382,16 +4383,14 @@ define([
var stringifyPath = function (path) { var stringifyPath = function (path) {
if (!Array.isArray(path)) { return; } if (!Array.isArray(path)) { return; }
var $div = $('<div>'); var div = h('div');
var i = 0;
var space = 10; var space = 10;
path.forEach(function (s) { path.forEach(function (s, i) {
if (i === 0) { s = getPrettyName(s); } if (i === 0) { s = getPrettyName(s); }
$div.append($('<span>', {'style': 'margin: 0 0 0 ' + i * space + 'px;'}).text(s)); div.appendChild(h('span', { style: 'margin: 0 0 0 ' + i * space + 'px', }, s));
$div.append($('<br>')); div.appendChild(h(('br')));
i++;
}); });
return $div.html(); return div;
}; };
// Disable middle click in the context menu to avoid opening /drive/inner.html# in new tabs // Disable middle click in the context menu to avoid opening /drive/inner.html# in new tabs
@ -4863,8 +4862,11 @@ define([
if (paths.length !== 1 || pPath.length !== 4) { return; } if (paths.length !== 1 || pPath.length !== 4) { return; }
var element = manager.find(pPath.slice(0,3)); // element containing the oldpath var element = manager.find(pPath.slice(0,3)); // element containing the oldpath
var sPath = stringifyPath(element.path); var sPath = stringifyPath(element.path);
UI.alert('<strong>' + Messages.fm_originalPath + "</strong>:<br>" + sPath, undefined, true); return void UI.alert(h('span', [
return; h('strong', Messages.fm_originalPath),
h('br'),
sPath,
]));
} }
if (paths.length !== 1) { return; } if (paths.length !== 1) { return; }
el = manager.find(paths[0].path); el = manager.find(paths[0].path);

Loading…
Cancel
Save