Fix issue with relativeLinksMethod and limit not applying to manage links

This commit is contained in:
Ilango
2024-02-06 10:36:27 +05:30
parent 7faaf13ccc
commit 7486d33237
4 changed files with 12 additions and 7 deletions
+2 -1
View File
@@ -1148,8 +1148,9 @@ 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
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, 0) : await xmlScrape(url, 0)
const links: string[] = relativeLinksMethod === 'webCrawl' ? await webCrawl(url, limit) : await xmlScrape(url, limit)
res.json({ status: 'OK', links })
})