Skip to content

Commit 475e75a

Browse files
asmitha-16Asmitha Bjasonsaayman
authored
feat: add input validation to isAbsoluteURL (#7326)
* Add input validation to isAbsoluteURL * chore: add removed doc block --------- Co-authored-by: Asmitha B <[email protected]> Co-authored-by: Jay <[email protected]>
1 parent 28c7215 commit 475e75a

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

lib/helpers/isAbsoluteURL.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,10 @@ export default function isAbsoluteURL(url) {
1111
// A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
1212
// RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
1313
// by any combination of letters, digits, plus, period, or hyphen.
14+
if (typeof url !== 'string') {
15+
return false;
16+
}
17+
1418
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
1519
}
20+

0 commit comments

Comments
 (0)