Skip to content

Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥

fix(v1): proper Invalid URL handling

Gergo Moricz26f2095de611
diff --git a/apps/api/src/controllers/v1/types.ts b/apps/api/src/controllers/v1/types.ts
index 63ec1dd40..f812f9819 100644
--- a/apps/api/src/controllers/v1/types.ts
+++ b/apps/api/src/controllers/v1/types.ts
@@ -30,7 +30,14 @@ export const url = z.preprocess(
"URL must have a valid top-level domain or be a valid path"
)
.refine(
- (x) => checkUrl(x as string),
+ (x) => {
+ try {
+ checkUrl(x as string)
+ return true;
+ } catch (_) {
+ return false;
+ }
+ },
"Invalid URL"
)
.refine(