From faa3d78f5c035670bcf6a16be251800f11167fb5 Mon Sep 17 00:00:00 2001 From: varjolintu Date: Sun, 28 Feb 2021 13:45:14 +0200 Subject: [PATCH] Handle Site Preferences URLs as lower case --- keepassxc-browser/content/keepassxc-browser.js | 6 +++--- keepassxc-browser/options/options.js | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/keepassxc-browser/content/keepassxc-browser.js b/keepassxc-browser/content/keepassxc-browser.js index b1f8d4e..6efd904 100755 --- a/keepassxc-browser/content/keepassxc-browser.js +++ b/keepassxc-browser/content/keepassxc-browser.js @@ -644,7 +644,7 @@ kpxc.url = null; // Add page to Site Preferences with Username-only detection enabled. Set from the popup kpxc.addToSitePreferences = async function() { // Returns a predefined URL for certain sites - let site = trimURL(window.top.location.href); + let site = trimURL(window.top.location.href).toLowerCase(); // Check if the site already exists -> update the current settings let siteExists = false; @@ -1437,11 +1437,11 @@ kpxc.siteIgnored = async function(condition) { if (kpxc.settings.sitePreferences) { let currentLocation; try { - currentLocation = window.top.location.href; + currentLocation = window.top.location.href.toLowerCase(); } catch (err) { // Cross-domain security error inspecting window.top.location.href. // This catches an error when an iframe is being accessed from another (sub)domain -> use the iframe URL instead. - currentLocation = window.self.location.href; + currentLocation = window.self.location.href.toLowerCase(); } const currentSetting = condition || IGNORE_FULL; diff --git a/keepassxc-browser/options/options.js b/keepassxc-browser/options/options.js index 2465d26..7d3f5ac 100644 --- a/keepassxc-browser/options/options.js +++ b/keepassxc-browser/options/options.js @@ -502,14 +502,14 @@ options.initSitePreferences = function() { trClone.removeClass('clone d-none'); const tr = trClone.clone(true); - tr.data('url', value); + tr.data('url', value.toLowerCase()); tr.attr('id', 'tr-scf' + newValue); tr.children('td:first').text(value); tr.children('td:nth-child(2)').children('select').val(IGNORE_NOTHING); $('#tab-site-preferences table tbody:first').append(tr); $('#tab-site-preferences table tbody:first tr.empty:first').hide(); - options.settings['sitePreferences'].push({ url: value, ignore: IGNORE_NOTHING, usernameOnly: false }); + options.settings['sitePreferences'].push({ url: value.toLowerCase(), ignore: IGNORE_NOTHING, usernameOnly: false }); options.saveSettings(); manualUrl.value = ''; }