mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 23:01:09 +03:00
Prevent server from crashing when link is empty or invalid
This commit is contained in:
@@ -1150,6 +1150,7 @@ export class App {
|
||||
// ----------------------------------------
|
||||
|
||||
this.app.get('/api/v1/fetch-links', async (req: Request, res: Response) => {
|
||||
try {
|
||||
const url = decodeURIComponent(req.query.url as string)
|
||||
const relativeLinksMethod = req.query.relativeLinksMethod as string
|
||||
if (!relativeLinksMethod) {
|
||||
@@ -1162,6 +1163,9 @@ export class App {
|
||||
if (process.env.DEBUG === 'true') console.info(`Finish ${relativeLinksMethod}`)
|
||||
|
||||
res.json({ status: 'OK', links })
|
||||
} catch (e: any) {
|
||||
return res.status(500).send('Could not fetch links from the URL.')
|
||||
}
|
||||
})
|
||||
|
||||
// ----------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user