fix(url validation): sub paths

This commit is contained in:
rafaelsideguide 2024-08-26 18:12:03 -03:00
parent 0bbb8bb24e
commit f2f6f78dcf
1 changed files with 4 additions and 1 deletions

View File

@ -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."