Skip to content

Commit

Permalink
fix(cdk): support : inside path segment in url (#9549)
Browse files Browse the repository at this point in the history
  • Loading branch information
splincode authored Oct 21, 2024
1 parent c4067fd commit 8317b67
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion projects/cdk/utils/miscellaneous/is-valid-url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export function tuiIsValidUrl(url: string): boolean {
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`(\:\d+)?(\/[-a-z\d%_.~+\:]*)*` + // port and path
String.raw`(\?[)(;&a-z\d%_.~+=-]*)?` + // query string
String.raw`(\#[-a-z\d_]*)?$`, // fragment locator
'i',
Expand Down
1 change: 1 addition & 0 deletions projects/cdk/utils/miscellaneous/test/is-valid-url.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ describe('tuiIsValidUrl', () => {
expect(tuiIsValidUrl('127.0.0.1:8080')).toBe(true);
expect(tuiIsValidUrl('localhost:3333')).toBe(true);
expect(tuiIsValidUrl('ftp://ftp.example:21/')).toBe(true);
expect(tuiIsValidUrl('https://domain.com/path:some:schema:data:test')).toBe(true);

expect(
tuiIsValidUrl(
Expand Down

0 comments on commit 8317b67

Please sign in to comment.