fix(is.ts): 修复isUrl正则不能匹配到 hash模式的外链 的问题 (#2051)

Co-authored-by: 苗大 <v.caoshm@yoozoo.com>
This commit is contained in:
Wit〆苗大
2022-07-07 15:42:50 +08:00
committed by GitHub
parent bc55b92c9b
commit 6f5711b088

View File

@@ -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_]*)#?(?:[\w]*))?)$/;
return reg.test(path);
}