Browse Source

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

Co-authored-by: 苗大 <v.caoshm@yoozoo.com>
pull/2041/head
Wit〆苗大 4 years ago
committed by GitHub
parent
commit
91e13c4287
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      src/utils/is.ts

2
src/utils/is.ts

@ -94,6 +94,6 @@ export const isClient = !isServer;
export function isUrl(path: string): boolean {
const reg =
/(((^https?:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+(?::\d+)?|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)$/;
/^(((^https?:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+(?::\d+)?|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)$/;
return reg.test(path);
}

Loading…
Cancel
Save