fix(url validation): sub paths

This commit is contained in:
rafaelsideguide
2024-08-26 18:12:03 -03:00
parent 0bbb8bb24e
commit f2f6f78dcf
+4 -1
View File
@@ -27,7 +27,10 @@ const url = z.preprocess(
.string() .string()
.url() .url()
.regex(/^https?:\/\//, "URL uses unsupported protocol") .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( .refine(
(x) => !isUrlBlocked(x), (x) => !isUrlBlocked(x),
"Firecrawl currently does not support social media scraping due to policy restrictions. We're actively working on building support for it." "Firecrawl currently does not support social media scraping due to policy restrictions. We're actively working on building support for it."