From 3b4d2bde3910c4570af9c759a5e621956816727c Mon Sep 17 00:00:00 2001 From: Zachary Keeping Date: Tue, 24 Oct 2023 16:02:14 +1100 Subject: [PATCH 1/2] Disable unscannable links filtering --- api/functions/index.js | 6 +++--- docker/sswlinkauditor.go | 1 + ui/src/containers/LinkReport.svelte | 10 +++------- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/api/functions/index.js b/api/functions/index.js index dee5f6e3..a986e309 100644 --- a/api/functions/index.js +++ b/api/functions/index.js @@ -262,11 +262,11 @@ app.post('/scanresult/:api/:buildId', async (req, res) => { url, cloc, totalBrokenLinks: badUrls.length, - uniqueBrokenLinks: R.uniqBy(R.prop('dst'), badUrls.filter((x) => !unscannableLinks.some(link => x.dst.includes(link)))).length, - pagesWithBrokenLink: R.uniqBy(R.prop('src'), badUrls.filter((x) => !unscannableLinks.some(link => x.dst.includes(link)))).length, + uniqueBrokenLinks: R.uniqBy(R.prop('dst'), badUrls).length, + pagesWithBrokenLink: R.uniqBy(R.prop('src'), badUrls).length, totalUnique404: R.uniqBy( R.prop('dst'), - badUrls.filter((x) => x.statuscode === '404' && !unscannableLinks.some(link => x.dst.includes(link))) + badUrls.filter((x) => x.statuscode === '404') ).length, htmlWarnings: htmlWarnings ? htmlWarnings : 0, htmlErrors: htmlErrors ? htmlErrors : 0, diff --git a/docker/sswlinkauditor.go b/docker/sswlinkauditor.go index c56d59ba..5f765e24 100644 --- a/docker/sswlinkauditor.go +++ b/docker/sswlinkauditor.go @@ -54,6 +54,7 @@ func check(link Link, linkch chan LinkStatus, number int, unscannableLinks []str } method := "HEAD" + // get list of links we consider unscannable and use a GET request to get a more accurate result if isLinkUnscannable(link.url, unscannableLinks) { method = "GET" } diff --git a/ui/src/containers/LinkReport.svelte b/ui/src/containers/LinkReport.svelte index 8032e661..e5b98258 100644 --- a/ui/src/containers/LinkReport.svelte +++ b/ui/src/containers/LinkReport.svelte @@ -25,16 +25,12 @@ if (currentRoute.namedParams.id) { promise = new Promise(async (resolve) => { const buildDetails = await getBuildDetails(currentRoute.namedParams.id); - const resp = await fetch(`${CONSTS.API}/api/unscannablelinks`); - const unscannableLinks = await resp.json(); - resolve({ buildDetails, unscannableLinks }); + resolve({ buildDetails }); }); } else { promise = new Promise(async (resolve) => { const buildDetails = await getLatestBuildDetails(currentRoute.namedParams.api, currentRoute.namedParams.url); - const resp = await fetch(`${CONSTS.API}/api/unscannablelinks`); - const unscannableLinks = await resp.json(); - resolve({ buildDetails, unscannableLinks }); + resolve({ buildDetails }); }); } @@ -90,7 +86,7 @@ on:ignore={url => showIgnore(data.buildDetails.summary.url, url, $userSession$)} builds={data.buildDetails ? data.buildDetails.brokenLinks : []} {currentRoute} - unscannableLinks={data.unscannableLinks} + unscannableLinks={[]} /> {:catch error} From 89afcd27e45afe076299adf174dffc6b1518bfa7 Mon Sep 17 00:00:00 2001 From: Zachary Keeping Date: Tue, 24 Oct 2023 17:07:24 +1100 Subject: [PATCH 2/2] Remove unused code --- ui/src/containers/LinkReport.svelte | 1 - 1 file changed, 1 deletion(-) diff --git a/ui/src/containers/LinkReport.svelte b/ui/src/containers/LinkReport.svelte index e5b98258..38c25f31 100644 --- a/ui/src/containers/LinkReport.svelte +++ b/ui/src/containers/LinkReport.svelte @@ -12,7 +12,6 @@ import LoadingFlat from "../components/misccomponents/LoadingFlat.svelte"; import UpdateIgnoreUrl from "../components/misccomponents/UpdateIgnoreUrl.svelte"; import BuildDetailsSlot from "../components/detailslotcomponents/BuildDetailsSlot.svelte"; - import { CONSTS } from "../utils/utils"; export let currentRoute;