Skip to content

Commit

Permalink
Handle non-ascii characters in single and bulk link scraper URLs (#2495)
Browse files Browse the repository at this point in the history
handle non-ascii characters in urls
  • Loading branch information
shatfield4 authored Oct 18, 2024
1 parent 93d7ce6 commit 41522cd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion collector/processLink/convert/generic.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ async function scrapeGenericUrl(link, textOnly = false) {
}

const url = new URL(link);
const filename = (url.host + "-" + url.pathname).replace(".", "_");
const decodedPathname = decodeURIComponent(url.pathname);
const filename = `${url.hostname}${decodedPathname.replace(/\//g, '_')}`;

const data = {
id: v4(),
Expand Down
3 changes: 2 additions & 1 deletion collector/utils/extensions/WebsiteDepth/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ async function bulkScrapePages(links, outFolderPath) {
}

const url = new URL(link);
const filename = (url.host + "-" + url.pathname).replace(".", "_");
const decodedPathname = decodeURIComponent(url.pathname);
const filename = `${url.hostname}${decodedPathname.replace(/\//g, '_')}`;

const data = {
id: v4(),
Expand Down

0 comments on commit 41522cd

Please sign in to comment.