Skip to content

Commit bff048a

Browse files
Potential fix for code scanning alert no. 63: Inefficient regular expression
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
1 parent 22737bd commit bff048a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/apps/profiles/src/lib/helpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ export function subTrackLabelToHumanName(label: string): string {
9090
export function isValidURL(urlToValidate: string): boolean {
9191
const pattern = new RegExp(
9292
'^(https?:\\/\\/)?' // protocol
93-
+ '((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|' // domain name
93+
+ '((([a-z\\d](?:[a-z\\d-]*[a-z\\d])?)\\.)+[a-z]{2,}|' // domain name, forbid leading/trailing dash in label
9494
+ '((\\d{1,3}\\.){3}\\d{1,3}))' // OR IP (v4) address
9595
+ '(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*' // port and path
9696
+ '(\\?[;&a-z\\d%_.~+=-]*)?' // query string

0 commit comments

Comments
 (0)