Fix error when dealing with invalid certificates (#3893)

This commit is contained in:
Tom Najdek 2024-03-29 12:44:40 +01:00 committed by GitHub
parent 0f8dce630d
commit 45bd374530
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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(