mirror of
https://github.com/bitwarden/browser
synced 2025-12-15 07:43:35 +00:00
[PS-1123] Improve hostname and domain retrieval (#3168)
* Add test cases from previous PR https://github.com/bitwarden/jslib/pull/547 * Install tldts as replacement for tldjs * Use tldts for hostname and domain retrieval/validation * Remove usage of old tldjs.noop-implementation * Add handling of about protocol * Remove usage of tldEndingRegex and use tldts check instead * Uninstall @types/tldjs and tldjs * Updated package-lock.json * Fix accessibility cookie check * Rename loginUriView.spec to login-uri-view.spec * Add test for getDomain failing file links * getHostName - Return null when given, data, about or file links
This commit is contained in:
committed by
GitHub
parent
94e9744d06
commit
8c59eef257
@@ -100,7 +100,7 @@ export class LoginUriView implements View {
|
||||
this.uri != null &&
|
||||
(this.uri.indexOf("http://") === 0 ||
|
||||
this.uri.indexOf("https://") === 0 ||
|
||||
(this.uri.indexOf("://") < 0 && Utils.tldEndingRegex.test(this.uri)))
|
||||
(this.uri.indexOf("://") < 0 && !Utils.isNullOrWhitespace(Utils.getDomain(this.uri))))
|
||||
);
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ export class LoginUriView implements View {
|
||||
}
|
||||
|
||||
get launchUri(): string {
|
||||
return this.uri.indexOf("://") < 0 && Utils.tldEndingRegex.test(this.uri)
|
||||
return this.uri.indexOf("://") < 0 && !Utils.isNullOrWhitespace(Utils.getDomain(this.uri))
|
||||
? "http://" + this.uri
|
||||
: this.uri;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user