diff --git a/packages/server/src/index.ts b/packages/server/src/index.ts
index bd153594..ab405e35 100644
--- a/packages/server/src/index.ts
+++ b/packages/server/src/index.ts
@@ -1245,18 +1245,22 @@ 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.')
+ try {
+ 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)
+ 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.')
}
-
- 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)
- if (process.env.DEBUG === 'true') console.info(`Finish ${relativeLinksMethod}`)
-
- res.json({ status: 'OK', links })
})
// ----------------------------------------
diff --git a/packages/ui/src/ui-component/dialog/ManageScrapedLinksDialog.js b/packages/ui/src/ui-component/dialog/ManageScrapedLinksDialog.js
index a4199504..25efd9b6 100644
--- a/packages/ui/src/ui-component/dialog/ManageScrapedLinksDialog.js
+++ b/packages/ui/src/ui-component/dialog/ManageScrapedLinksDialog.js
@@ -16,7 +16,7 @@ import {
Stack,
Typography
} from '@mui/material'
-import { IconTrash, IconX } from '@tabler/icons'
+import { IconEraser, IconTrash, IconX } from '@tabler/icons'
import PerfectScrollbar from 'react-perfect-scrollbar'
import { BackdropLoader } from 'ui-component/loading/BackdropLoader'
@@ -113,6 +113,10 @@ const ManageScrapedLinksDialog = ({ show, dialogProps, onCancel, onSave }) => {
setSelectedLinks(links)
}
+ const handleRemoveAllLinks = () => {
+ setSelectedLinks([])
+ }
+
const handleSaveLinks = () => {
onSave(url, selectedLinks)
}
@@ -145,6 +149,7 @@ const ManageScrapedLinksDialog = ({ show, dialogProps, onCancel, onSave }) => {
/>
- Scraped Links
+
+ Scraped Links
+ {selectedLinks.length > 0 ? (
+ }
+ >
+ Clear All
+
+ ) : null}
+
<>
{loading && }
{selectedLinks.length > 0 ? (