From d691b1797fb318c615323b1802d2a673f389dda6 Mon Sep 17 00:00:00 2001 From: wirednkod Date: Fri, 3 Nov 2023 13:50:34 +0200 Subject: [PATCH] minor --- javascript/packages/utils/src/misc.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/javascript/packages/utils/src/misc.ts b/javascript/packages/utils/src/misc.ts index 34d2a4a5d..45326b186 100644 --- a/javascript/packages/utils/src/misc.ts +++ b/javascript/packages/utils/src/misc.ts @@ -155,7 +155,7 @@ export function getFilePathNameExt(filePath: string): { export function validateImageUrl(image: string): string { const regex = - /^(?(?<=^)(?:(?(?:(?:localhost|[\w-]+(?:\.[\w-]+)+)(?::\d+)?)|[\w]+:\d+)\/)?\/?(?(?:(?:[a-z0-9]+(?:(?:[._]|__|[-]*)[a-z0-9]+)*)\/)*)(?[a-z0-9-]+))[:@]?(?(?<=:)(?[\w][\w.-]{0,127})|(?<=@)(?[A-Za-z][A-Za-z0-9]*(?:[-_+.][A-Za-z][A-Za-z0-9]*)*[:][0-9A-Fa-f]{32,}))?$/gm; + /^(?(?<=^)(?:(?(?:(?:localhost|[\w-]+(?:\.[\w-]+)+)(?::\d+)?)|[\w]+:\d+)\/)?\/?(?(?:(?:[a-z0-9]+(?:(?:[._]|__|[-]*)[a-z0-9]+)*)\/)*)(?[a-z0-9-]+))[:@]?(?(?<=:)(?[\w][\w.-]{0,127})|(?<=@)(?[A-Za-z][A-Za-z0-9]*(?:[-_+.][A-Za-z][A-Za-z0-9]*)*[:][0-9A-Fa-f]{32,}))?/gm; if (!image.match(regex)) { throw new Error("Image's URL is invalid: `" + image + "`");