From 45bd3745301115286c528858f60268183635a068 Mon Sep 17 00:00:00 2001 From: Tom Najdek Date: Fri, 29 Mar 2024 12:44:40 +0100 Subject: [PATCH] Fix error when dealing with invalid certificates (#3893) --- chrome/content/zotero/xpcom/http.js | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/chrome/content/zotero/xpcom/http.js b/chrome/content/zotero/xpcom/http.js index 2828714995..e093fbd0a2 100644 --- a/chrome/content/zotero/xpcom/http.js +++ b/chrome/content/zotero/xpcom/http.js @@ -1268,17 +1268,15 @@ Zotero.HTTP = new function() { secInfo.QueryInterface(Ci.nsITransportSecurityInfo); if ((secInfo.securityState & Ci.nsIWebProgressListener.STATE_IS_INSECURE) == Ci.nsIWebProgressListener.STATE_IS_INSECURE) { - // Show actual error from the networking stack, with the hyperlink around the - // error code removed - msg = Zotero.Utilities.unescapeHTML(secInfo.errorMessage); - if (msg.includes('.' + ZOTERO_CONFIG.DOMAIN_NAME + ' ') - || msg.includes(ZOTERO_CONFIG.PROXY_AUTH_URL.match(/^https:\/\/([^\/]+)\//)[1] + ' ')) { + msg = secInfo.errorCodeString; + if (channel.originalURI?.spec.includes(ZOTERO_CONFIG.DOMAIN_NAME) + || channel.originalURI?.spec.includes(ZOTERO_CONFIG.PROXY_AUTH_URL.match(/^https:\/\/([^\/]+)\//)[1])) { msg = Zotero.getString('networkError.connectionMonitored', Zotero.appName) + "\n\n" + (isProxyAuthRequest ? Zotero.getString('startupError.internetFunctionalityMayNotWork') + "\n\n" : "") - + Zotero.getString('general.error') + ": " + msg.split(/\n/)[0]; + + msg; } dialogButtonText = Zotero.getString('general.moreInformation'); dialogButtonCallback = function () { @@ -1287,8 +1285,7 @@ Zotero.HTTP = new function() { } else if ((secInfo.securityState & Ci.nsIWebProgressListener.STATE_IS_BROKEN) == Ci.nsIWebProgressListener.STATE_IS_BROKEN) { - msg = Zotero.getString('networkError.connectionNotSecure') - + Zotero.Utilities.unescapeHTML(secInfo.errorMessage); + msg = secInfo.errorCodeString; } if (msg) { throw new Zotero.HTTP.SecurityException(