Include domain in insecure-connection error

This commit is contained in:
Dan Stillman 2024-04-02 05:50:42 -04:00 committed by Dan Stillman
parent 35aaa013ed
commit 423393c78b
2 changed files with 11 additions and 10 deletions

View file

@ -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)
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
}

View file

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