Skip to content

Commit

Permalink
Merge pull request #733 from SSWConsulting/unscannable-links-fix
Browse files Browse the repository at this point in the history
Don't filter unscannable links in UI
  • Loading branch information
tombui99 authored Oct 24, 2023
2 parents c459fd2 + 89afcd2 commit 5086bea
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
6 changes: 3 additions & 3 deletions api/functions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions docker/sswlinkauditor.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down
11 changes: 3 additions & 8 deletions ui/src/containers/LinkReport.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -25,16 +24,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 });
});
}
Expand Down Expand Up @@ -90,7 +85,7 @@
on:ignore={url => showIgnore(data.buildDetails.summary.url, url, $userSession$)}
builds={data.buildDetails ? data.buildDetails.brokenLinks : []}
{currentRoute}
unscannableLinks={data.unscannableLinks}
unscannableLinks={[]}
/>
</BuildDetailsSlot>
{:catch error}
Expand Down

0 comments on commit 5086bea

Please sign in to comment.