Show error when relative links method is not set and allow 0 as limit value

This commit is contained in:
Ilango
2024-02-12 12:01:19 +05:30
parent c2ae7e138c
commit 5471a4c9aa
5 changed files with 58 additions and 8 deletions
+4
View File
@@ -1148,6 +1148,10 @@ export class App {
this.app.get('/api/v1/fetch-links', async (req: Request, res: Response) => {
const url = decodeURIComponent(req.query.url as string)
const relativeLinksMethod = req.query.relativeLinksMethod as string
if (!relativeLinksMethod) {
return res.status(500).send('Please choose a Relative Links Method in Additional Parameters.')
}
const limit = parseInt(req.query.limit as string)
if (process.env.DEBUG === 'true') console.info(`Start ${relativeLinksMethod}`)
const links: string[] = relativeLinksMethod === 'webCrawl' ? await webCrawl(url, limit) : await xmlScrape(url, limit)