Skip to content

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

feat: make URL protocol checks case-insensitive (#1788)

devin-ai-integration[bot]ff9544cd6725
diff --git a/apps/api/src/controllers/v1/types.ts b/apps/api/src/controllers/v1/types.ts
index 7064ce9e1..5de6eb3c8 100644
--- a/apps/api/src/controllers/v1/types.ts
+++ b/apps/api/src/controllers/v1/types.ts
@@ -59,7 +59,7 @@ export const url = z.preprocess(
z
.string()
.url()
- .regex(/^https?:\/\//, "URL uses unsupported protocol")
+ .regex(/^https?:\/\//i, "URL uses unsupported protocol")
.refine(
(x) =>
/(\.[a-zA-Z0-9-\u0400-\u04FF\u0500-\u052F\u2DE0-\u2DFF\uA640-\uA69F]{2,}|\.xn--[a-zA-Z0-9-]{1,})(:\d+)?([\/?#]|$)/i.test(
diff --git a/apps/api/src/lib/validateUrl.ts b/apps/api/src/lib/validateUrl.ts
index d7672bb95..6216e0ec5 100644
--- a/apps/api/src/lib/validateUrl.ts
+++ b/apps/api/src/lib/validateUrl.ts
@@ -1,7 +1,7 @@
export const protocolIncluded = (url: string) => {
// if :// not in the start of the url assume http (maybe https?)
// regex checks if :// appears before any .
- return /^([^.:]+:\/\/)/.test(url);
+ return /^([^.:]+:\/\/)/i.test(url);
};
const getURLobj = (s: string) => {