From cfd50c0c07fba12c02a70ffee69fffd8f6a821a5 Mon Sep 17 00:00:00 2001 From: Matt Hill Date: Mon, 15 May 2023 11:36:31 -0600 Subject: [PATCH] require http/https for full url regexes --- lib/util/regexes.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/util/regexes.ts b/lib/util/regexes.ts index 3af48f8..f261963 100644 --- a/lib/util/regexes.ts +++ b/lib/util/regexes.ts @@ -15,13 +15,13 @@ export const torHostname = /[-a-zA-Z0-9@:%._\+~#=]{1,256}\.onion/ // https://ihateregex.io/expr/url/ export const url = - /(https?:\/\/)?(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()!@:%_\+.~#?&\/\/=]*)/ + /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()!@:%_\+.~#?&\/\/=]*)/ export const localUrl = - /(https?:\/\/)?(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.local\b([-a-zA-Z0-9()!@:%_\+.~#?&\/\/=]*)/ + /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.local\b([-a-zA-Z0-9()!@:%_\+.~#?&\/\/=]*)/ export const torUrl = - /(https?:\/\/)?(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.onion\b([-a-zA-Z0-9()!@:%_\+.~#?&\/\/=]*)/ + /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.onion\b([-a-zA-Z0-9()!@:%_\+.~#?&\/\/=]*)/ // https://ihateregex.io/expr/ascii/ export const ascii = /^[ -~]*$/