-
Notifications
You must be signed in to change notification settings - Fork 474
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(cdk): support any query string inside URL
- Loading branch information
Showing
2 changed files
with
16 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,14 @@ | ||
/** | ||
* @deprecated: drop in v5.0 | ||
*/ | ||
export function tuiIsValidUrl(url: string): boolean { | ||
const pattern = new RegExp( | ||
return new RegExp( | ||
String.raw`^([a-zA-Z]+:\/\/)?` + // protocol | ||
String.raw`((([a-z\d]([a-z\d-]*[a-z\d])*)\.)+[a-z]{2,}|localhost|` + // domain name | ||
String.raw`((\d{1,3}\.){3}\d{1,3}))` + // OR IP (v4) address | ||
String.raw`(\:\d+)?(\/[-a-z\d%_.~+]*)*` + // port and path | ||
String.raw`(\?[;&a-z\d%_.~+=-]*)?` + // query string | ||
String.raw`(\?.*)?` + // query string | ||
String.raw`(\#[-a-z\d_]*)?$`, // fragment locator | ||
'i', | ||
); | ||
|
||
return pattern.test(url); | ||
).test(url); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters