Commit 91e13c4287ece777d65b3a19ce5ee23eabe4782f

Authored by Wit〆苗大
Committed by GitHub
1 parent de727939

fix(is.ts): fix#2028 修复isUrl正则可以匹配到/www问题 (#2033)

Co-authored-by: 苗大 <v.caoshm@yoozoo.com>
Showing 1 changed file with 1 additions and 1 deletions
src/utils/is.ts
@@ -94,6 +94,6 @@ export const isClient = !isServer; @@ -94,6 +94,6 @@ export const isClient = !isServer;
94 94
95 export function isUrl(path: string): boolean { 95 export function isUrl(path: string): boolean {
96 const reg = 96 const reg =
97 - /(((^https?:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+(?::\d+)?|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)$/; 97 + /^(((^https?:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+(?::\d+)?|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)$/;
98 return reg.test(path); 98 return reg.test(path);
99 } 99 }