mirror of
https://github.com/keepassxreboot/keepassxc-browser.git
synced 2026-03-11 08:54:43 +00:00
Remove IP regex
This commit is contained in:
parent
ea84842c81
commit
ec82eabda2
1 changed files with 2 additions and 7 deletions
|
|
@ -141,16 +141,11 @@ const slashNeededForUrl = function(pattern) {
|
|||
};
|
||||
|
||||
// Returns the top level domain, e.g. https://another.example.co.uk -> example.co.uk
|
||||
// This is done because a top level domain will probably give better matches with Auto-Type than a full hostname.
|
||||
const getTopLevelDomainFromUrl = function(hostname) {
|
||||
const ipRegex = new RegExp(/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/g);
|
||||
const domainRegex = new RegExp(/(\w+).(com|net|org|edu|co)*(.\w+)$/g);
|
||||
|
||||
// If the hostname is an IP address, return it directly
|
||||
if (hostname.match(ipRegex)) {
|
||||
return hostname;
|
||||
}
|
||||
|
||||
const domainMatch = domainRegex.exec(hostname);
|
||||
|
||||
if (domainMatch) {
|
||||
return domainMatch[0];
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue