Skip to content

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

fix(crawl): send error if url is not a string

Gergő Móricz14fa75cae6a6
diff --git a/apps/api/src/controllers/crawl.ts b/apps/api/src/controllers/crawl.ts
index d40f2a9e1..2e31c2576 100644
--- a/apps/api/src/controllers/crawl.ts
+++ b/apps/api/src/controllers/crawl.ts
@@ -72,6 +72,9 @@ export async function crawlController(req: Request, res: Response) {
if (!url) {
return res.status(400).json({ error: "Url is required" });
}
+ if (typeof url !== "string") {
+ return res.status(400).json({ error: "URL must be a string" });
+ }
try {
url = checkAndUpdateURL(url).url;
} catch (e) {
@@ -87,8 +90,6 @@ export async function crawlController(req: Request, res: Response) {
});
}
- const mode = req.body.mode ?? "crawl";
-
// if (mode === "single_urls" && !url.includes(",")) { // NOTE: do we need this?
// try {
// const a = new WebScraperDataProvider();