From 423393c78b049e161158e4f40741ed96f51de72d Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Tue, 2 Apr 2024 05:50:42 -0400 Subject: [PATCH] Include domain in insecure-connection error --- chrome/content/zotero/xpcom/http.js | 18 +++++++++--------- chrome/locale/en-US/zotero/zotero.properties | 3 ++- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/chrome/content/zotero/xpcom/http.js b/chrome/content/zotero/xpcom/http.js index 1030061eac..8dee33bee8 100644 --- a/chrome/content/zotero/xpcom/http.js +++ b/chrome/content/zotero/xpcom/http.js @@ -1269,16 +1269,19 @@ Zotero.HTTP = new function() { let dialogButtonCallback; if (state !== 'secure') { if (state === 'broken' || state === 'insecure') { - msg = errorMessage ?? channel.securityInfo?.errorCodeString ?? ''; + let domain = channel.originalURI?.host ?? ''; + msg = Zotero.getString('networkError.insecureConnectionTo', [Zotero.appName, domain]) + + "\n\n"; 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) + || 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" - : "") - + msg; + : ""); } + msg += errorMessage ?? channel.securityInfo?.errorCodeString ?? ''; + msg = msg.trim(); dialogButtonText = Zotero.getString('general.moreInformation'); dialogButtonCallback = function () { Zotero.launchURL('https://www.zotero.org/support/kb/ssl_certificate_error'); @@ -1288,10 +1291,7 @@ Zotero.HTTP = new function() { throw new Zotero.HTTP.SecurityException( msg, { - dialogHeader: Zotero.getString( - 'networkError.connectionNotSecure', - Zotero.clientName - ), + dialogHeader: Zotero.getString('networkError.connectionNotSecure'), dialogButtonText, dialogButtonCallback } diff --git a/chrome/locale/en-US/zotero/zotero.properties b/chrome/locale/en-US/zotero/zotero.properties index 01ee5cd24a..21628f3163 100644 --- a/chrome/locale/en-US/zotero/zotero.properties +++ b/chrome/locale/en-US/zotero/zotero.properties @@ -115,7 +115,8 @@ general.operationInProgress = A Zotero operation is currently in progress. general.operationInProgress.waitUntilFinished = Please wait until it has finished. general.operationInProgress.waitUntilFinishedAndTryAgain = Please wait until it has finished and try again. -networkError.connectionNotSecure = %S could not make a secure connection. +networkError.connectionNotSecure = Insecure Connection +networkError.insecureConnectionTo = %S could not make a secure connection to %S. networkError.errorViaProxy = Error connecting via proxy server networkError.connectionMonitored = Your connection is likely being monitored, and %S has not been configured to trust the intermediate server.