Skip to content

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

fix(api/batch/scrape): disallow 0 URLs post-filtering

Gergő Móricz56b0ba7ba470
diff --git a/apps/api/src/controllers/v1/batch-scrape.ts b/apps/api/src/controllers/v1/batch-scrape.ts
index 101821c3c..c12ff7a9f 100644
--- a/apps/api/src/controllers/v1/batch-scrape.ts
+++ b/apps/api/src/controllers/v1/batch-scrape.ts
@@ -96,6 +96,13 @@ export async function batchScrapeController(
}
}
+ if (urls.length === 0) {
+ return res.status(400).json({
+ success: false,
+ error: "No valid URLs provided",
+ });
+ }
+
logger.debug("Batch scrape " + id + " starting", {
urlsLength: urls.length,
appendToId: req.body.appendToId,
diff --git a/apps/api/src/controllers/v2/batch-scrape.ts b/apps/api/src/controllers/v2/batch-scrape.ts
index 9b4a86646..04a478bb1 100644
--- a/apps/api/src/controllers/v2/batch-scrape.ts
+++ b/apps/api/src/controllers/v2/batch-scrape.ts
@@ -96,6 +96,13 @@ export async function batchScrapeController(
}
}
+ if (urls.length === 0) {
+ return res.status(400).json({
+ success: false,
+ error: "No valid URLs provided",
+ });
+ }
+
logger.debug("Batch scrape " + id + " starting", {
urlsLength: urls.length,
appendToId: req.body.appendToId,