mirror of
https://github.com/mendableai/firecrawl.git
synced 2025-06-27 00:41:33 +00:00
Allow international URLs to pass validation (#1717)
This commit is contained in:
parent
1919799bed
commit
9a5d40c3cf
@ -76,4 +76,9 @@ describe("URL Schema Validation", () => {
|
|||||||
it("should reject malformed URLs containing multiple 'http://'", () => {
|
it("should reject malformed URLs containing multiple 'http://'", () => {
|
||||||
expect(() => url.parse("http://ex ample.com/")).toThrow("Invalid URL");
|
expect(() => url.parse("http://ex ample.com/")).toThrow("Invalid URL");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("should accept URLs with international domain names", () => {
|
||||||
|
expect(() => url.parse("http://xn--1lqv92a901a.xn--ses554g/")).not.toThrow();
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -61,7 +61,7 @@ export const url = z.preprocess(
|
|||||||
.regex(/^https?:\/\//, "URL uses unsupported protocol")
|
.regex(/^https?:\/\//, "URL uses unsupported protocol")
|
||||||
.refine(
|
.refine(
|
||||||
(x) =>
|
(x) =>
|
||||||
/\.[a-zA-Z\u0400-\u04FF\u0500-\u052F\u2DE0-\u2DFF\uA640-\uA69F]{2,}(:\d+)?([\/?#]|$)/i.test(
|
/\.[a-zA-Z0-9-\u0400-\u04FF\u0500-\u052F\u2DE0-\u2DFF\uA640-\uA69F]{2,}(:\d+)?([\/?#]|$)/i.test(
|
||||||
x,
|
x,
|
||||||
),
|
),
|
||||||
"URL must have a valid top-level domain or be a valid path",
|
"URL must have a valid top-level domain or be a valid path",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user