Skip to content

Commit e4b38d9

Browse files
authored
Merge pull request #1383 from topcoder-platform/alert-autofix-63
Potential fix for code scanning alert no. 63: Inefficient regular expression
2 parents 22737bd + bff048a commit e4b38d9

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)