Skip to content

Commit

Permalink
Update password-hiding logic for malformed-XML XHR errors in reports
Browse files Browse the repository at this point in the history
  • Loading branch information
dstillman committed Aug 15, 2017
1 parent b171b15 commit db8bb34
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions chrome/content/zotero/xpcom/zotero.js
Expand Up @@ -41,7 +41,6 @@ Services.scriptloader.loadSubScript("resource://zotero/polyfill.js");
this.debug = debug;
this.log = log;
this.logError = logError;
this.getErrors = getErrors;
this.localeJoin = localeJoin;
this.setFontSize = setFontSize;
this.flattenArguments = flattenArguments;
Expand Down Expand Up @@ -1297,21 +1296,22 @@ Services.scriptloader.loadSubScript("resource://zotero/polyfill.js");
}


function getErrors(asStrings) {
this.getErrors = function (asStrings) {
var errors = [];

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') {
try {
// 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) {}
}

if (asStrings) {
errors.push(altMessage ? altMessage : msg.message)
errors.push(altMessage || msg.message)
}
else {
errors.push(msg);
Expand Down

0 comments on commit db8bb34

Please sign in to comment.