From e6f7c6c21f9c47e8768fe05d020a691ccc2be146 Mon Sep 17 00:00:00 2001 From: Stefan Sundin Date: Thu, 29 Apr 2021 08:13:34 -0700 Subject: [PATCH] Do toLowerCase() earlier so the value that is added to the table is consistent after page refresh. This also prevents duplicates with different casing from being added. --- keepassxc-browser/options/options.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/keepassxc-browser/options/options.js b/keepassxc-browser/options/options.js index 5a31fe4..3fc3690 100644 --- a/keepassxc-browser/options/options.js +++ b/keepassxc-browser/options/options.js @@ -500,7 +500,7 @@ options.initSitePreferences = function() { return; } - let value = manualUrl.value; + let value = manualUrl.value.toLowerCase(); // Fills the last / char if needed. This ensures the compatibility with Match Patterns if (slashNeededForUrl(value)) { @@ -522,14 +522,14 @@ options.initSitePreferences = function() { trClone.removeClass('clone d-none'); const tr = trClone.clone(true); - tr.data('url', value.toLowerCase()); + tr.data('url', value); 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.toLowerCase(), ignore: IGNORE_NOTHING, usernameOnly: false }); + options.settings['sitePreferences'].push({ url: value, ignore: IGNORE_NOTHING, usernameOnly: false }); options.saveSettings(); manualUrl.value = ''; });