Merge pull request #1252 from keepassxreboot/fix/use_site_preferences_urls_with_lowercase

Handle Site Preferences URLs as lowercase
This commit is contained in:
Sami Vänttinen 2021-02-28 20:49:28 +02:00 committed by GitHub
commit 7342146eac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View file

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

View file

@ -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 = '';
}