fix(url): allow domains with ports

This commit is contained in:
Gergő Móricz
2025-01-16 16:29:52 +01:00
parent de14c0a45d
commit 655753cd27
2 changed files with 2 additions and 1 deletions
+1 -1
View File
@@ -34,7 +34,7 @@ export const url = z.preprocess(
.url() .url()
.regex(/^https?:\/\//, "URL uses unsupported protocol") .regex(/^https?:\/\//, "URL uses unsupported protocol")
.refine( .refine(
(x) => /\.[a-z]{2,}([\/?#]|$)/i.test(x), (x) => /\.[a-z]{2,}(:\d+)?([\/?#]|$)/i.test(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",
) )
.refine((x) => { .refine((x) => {
+1
View File
@@ -1126,5 +1126,6 @@ async function processJob(job: Job & { id: string }, token: string) {
await new Promise((resolve) => setTimeout(resolve, 500)); await new Promise((resolve) => setTimeout(resolve, 500));
} }
console.log("All jobs finished. Worker out!");
process.exit(0); process.exit(0);
})(); })();