Skip to content

Commit

Permalink
Fix basic auth sitemap scan
Browse files Browse the repository at this point in the history
  • Loading branch information
younglim committed Jun 6, 2024
1 parent d85496d commit 3c539c9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/constants/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,7 @@ export const getLinksFromSitemap = async (
? (url = addBasicAuthCredentials(url, username, password))
: url;

const request = new Request({ url: encodeURI(url) });
const request = new Request({ url: url });
if (isUrlPdf(url)) {
request.skipNavigation = true;
}
Expand Down
5 changes: 1 addition & 4 deletions src/crawlers/crawlSitemap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ const crawlSitemap = async (


printMessage(['Fetching URLs. This might take some time...'], { border: false });


finalLinks = [...finalLinks, ...linksFromSitemap];

Expand Down Expand Up @@ -149,8 +149,6 @@ const crawlSitemap = async (
preNavigationHooks: isBasicAuth
? [
async ({ page, request }) => {

request.url = encodeURI(request.url);
await page.setExtraHTTPHeaders({
Authorization: authHeader,
...extraHTTPHeaders,
Expand All @@ -159,7 +157,6 @@ const crawlSitemap = async (
]
: [
async ({ page, request }) => {
request.url = encodeURI(request.url);
preNavigationHooks(extraHTTPHeaders)
//insert other code here
},
Expand Down

0 comments on commit 3c539c9

Please sign in to comment.