Update password-hiding logic for malformed-XML XHR errors in reports

This commit is contained in:
Dan Stillman 2017-08-16 00:38:15 +02:00
parent b171b15d87
commit db8bb3484d

View File

@ -41,7 +41,6 @@ Services.scriptloader.loadSubScript("resource://zotero/polyfill.js");
this.debug = debug; this.debug = debug;
this.log = log; this.log = log;
this.logError = logError; this.logError = logError;
this.getErrors = getErrors;
this.localeJoin = localeJoin; this.localeJoin = localeJoin;
this.setFontSize = setFontSize; this.setFontSize = setFontSize;
this.flattenArguments = flattenArguments; this.flattenArguments = flattenArguments;
@ -1297,21 +1296,22 @@ Services.scriptloader.loadSubScript("resource://zotero/polyfill.js");
} }
function getErrors(asStrings) { this.getErrors = function (asStrings) {
var errors = []; var errors = [];
for (let msg of _startupErrors.concat(_recentErrors)) { for (let msg of _startupErrors.concat(_recentErrors)) {
// Remove password in malformed XML messages let altMessage;
// Remove password in malformed XML errors
if (msg.category == 'malformed-xml') { if (msg.category == 'malformed-xml') {
try { try {
// msg.message is read-only, so store separately // msg.message is read-only, so store separately
var altMessage = msg.message.replace(/(file: "https?:\/\/[^:]+:)([^@]+)(@[^"]+")/, "$1********$3"); altMessage = msg.message.replace(/(https?:\/\/[^:]+:)([^@]+)(@[^"]+)/, "$1****$3");
} }
catch (e) {} catch (e) {}
} }
if (asStrings) { if (asStrings) {
errors.push(altMessage ? altMessage : msg.message) errors.push(altMessage || msg.message)
} }
else { else {
errors.push(msg); errors.push(msg);