From f2f6f78dcfb419112fda6836ce063414d398384a Mon Sep 17 00:00:00 2001 From: rafaelsideguide <150964962+rafaelsideguide@users.noreply.github.com> Date: Mon, 26 Aug 2024 18:12:03 -0300 Subject: [PATCH] fix(url validation): sub paths --- apps/api/src/controllers/v1/types.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/api/src/controllers/v1/types.ts b/apps/api/src/controllers/v1/types.ts index f1358baf..8f92d46d 100644 --- a/apps/api/src/controllers/v1/types.ts +++ b/apps/api/src/controllers/v1/types.ts @@ -27,7 +27,10 @@ const url = z.preprocess( .string() .url() .regex(/^https?:\/\//, "URL uses unsupported protocol") - .regex(/\.[a-z]{2,}$/i, "URL must have a valid top-level domain") + .refine( + (x) => /\.[a-z]{2,}(\/|$)/i.test(x), + "URL must have a valid top-level domain or be a valid path" + ) .refine( (x) => !isUrlBlocked(x), "Firecrawl currently does not support social media scraping due to policy restrictions. We're actively working on building support for it."