Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cdk): support : inside path segment in url #9549

Merged
merged 1 commit into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
Loading