From 34d62426c369395aec8ef96a4e7dd70a795cc3ec Mon Sep 17 00:00:00 2001 From: Tom Najdek Date: Thu, 25 Nov 2021 00:55:17 +0100 Subject: [PATCH] Tweak URL matching regexp to be more precise Institutional login process goes through multiple pages, the URL regexp is tweaked to be more precise to ensure that no arbitrary URLs are matched while polling for the final URL with auth code. --- chrome/content/zotero/fileInterface.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chrome/content/zotero/fileInterface.js b/chrome/content/zotero/fileInterface.js index 2317b71c86..9e0e228048 100644 --- a/chrome/content/zotero/fileInterface.js +++ b/chrome/content/zotero/fileInterface.js @@ -857,7 +857,7 @@ var Zotero_File_Interface = new function() { this.authenticateMendeleyOnlinePoll = function (win) { if (win && win[0] && win[0].location) { - const matchResult = win[0].location.toString().match(/(?:\?|&)code=(.*?)(?:&|$)/i); + const matchResult = win[0].location.toString().match(/mendeley_oauth_redirect.html(?:.*?)(?:\?|&)code=(.*?)(?:&|$)/i); if (matchResult) { const mendeleyCode = matchResult[1]; Zotero.getMainWindow().setTimeout(() => this.showImportWizard({ mendeleyCode }), 0);