We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent de578ec commit be65d7dCopy full SHA for be65d7d
src/utils.ts
@@ -2,7 +2,7 @@ export function urlPath(path: string): string {
2
path = path.trim();
3
4
//regex to check if is an absolute url (with *a* protocol) or a valid URI
5
- const urlRegex = /^([a-z0-9]+:\/\/|www.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,63}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/i;
+ const urlRegex = /^(https?:\/\/)?([a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*|localhost)(:\d{1,5})?(\/[^\s]*)?$/i
6
7
if (path.match(urlRegex)) {
8
return path;
0 commit comments