avoid bypassing guards against raw HTML in some dialogs

pull/1/head
ansuz 4 years ago
parent 975259f935
commit 7f41f8765e

@ -3703,6 +3703,21 @@ define([
return false; return false;
}; };
UIElements.fixInlineBRs = function (htmlString) {
if (!htmlString && typeof(htmlString) === 'string') { return; }
var lines = htmlString.split('<br>');
if (lines.length === 1) { return lines; }
var len = lines.length - 1;
var result = [];
for (var i = 0; i <= len; i++) {
result.push(lines[i]);
if (i < len) {
result.push(h('br'));
}
}
return result;
};
UIElements.openSnapshotsModal = function (common, load, make, remove) { UIElements.openSnapshotsModal = function (common, load, make, remove) {
var modal; var modal;
var readOnly = common.getMetadataMgr().getPrivateData().readOnly; var readOnly = common.getMetadataMgr().getPrivateData().readOnly;

@ -981,11 +981,11 @@ define([
common.gotoURL(_href); common.gotoURL(_href);
}, {force: true}); }, {force: true});
} }
return void UI.alert(Messages.properties_passwordSuccess, function () { return void UI.alert(UIElements.fixInlineBRs(Messages.properties_passwordSuccess), function () {
if (!isSharedFolder) { if (!isSharedFolder) {
common.gotoURL(_href); common.gotoURL(_href);
} }
}, {force: true}); });
}); });
}); });
}); });

@ -279,10 +279,11 @@ define([
tippy: Messages.fm_burnThisDriveButton, tippy: Messages.fm_burnThisDriveButton,
drawer: false drawer: false
}, function () { }, function () {
UI.confirm(Messages.fm_burnThisDrive, function (yes) { var confirmContent = UIElements.fixInlineBRs(Messages.fm_burnThisDrive);
UI.confirm(confirmContent, function (yes) {
if (!yes) { return; } if (!yes) { return; }
common.getSframeChannel().event('EV_BURN_ANON_DRIVE'); common.getSframeChannel().event('EV_BURN_ANON_DRIVE');
}, null, true); });
}); });
} }

Loading…
Cancel
Save