mirror of
https://git.mirrors.martin98.com/https://github.com/mendableai/firecrawl
synced 2025-08-02 02:40:36 +08:00
fix(crawl): send error if url is not a string
Fixes FIRECRAWL-SCRAPER-JS-1E and FIRECRAWL-SCRAPER-JS-Z
This commit is contained in:
parent
0cdf41587e
commit
14fa75cae6
@ -72,6 +72,9 @@ export async function crawlController(req: Request, res: Response) {
|
|||||||
if (!url) {
|
if (!url) {
|
||||||
return res.status(400).json({ error: "Url is required" });
|
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 {
|
try {
|
||||||
url = checkAndUpdateURL(url).url;
|
url = checkAndUpdateURL(url).url;
|
||||||
} catch (e) {
|
} 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?
|
// if (mode === "single_urls" && !url.includes(",")) { // NOTE: do we need this?
|
||||||
// try {
|
// try {
|
||||||
// const a = new WebScraperDataProvider();
|
// const a = new WebScraperDataProvider();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user