From 354b893565b0a8cea4932420a2b95979eb7014c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=B5=A9=E8=BF=9C?= Date: Tue, 2 Feb 2021 14:49:50 +0800 Subject: [PATCH] fix regular expressions --- src/scripts/utils.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/scripts/utils.ts b/src/scripts/utils.ts index 91400e8..e594aa7 100644 --- a/src/scripts/utils.ts +++ b/src/scripts/utils.ts @@ -29,7 +29,7 @@ const rssParser = new Parser({ }) const CHARSET_RE = /charset=([^()<>@,;:\"/[\]?.=\s]*)/i -const XML_ENCODING_RE = /^<\?xml.+encoding="(.+)".*?\?>/i +const XML_ENCODING_RE = /^<\?xml.+encoding="(.+?)".*?\?>/i export async function decodeFetchResponse(response: Response, isHTML = false) { const buffer = await response.arrayBuffer() let ctype = response.headers.has("content-type") && response.headers.get("content-type") @@ -122,7 +122,7 @@ export function htmlDecode(input: string) { } export const urlTest = (s: string) => - /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/gi.test(s) + /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,63}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/gi.test(s) export const getWindowBreakpoint = () => window.outerWidth >= 1440