Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't filter unscannable links in UI #733

Merged
merged 2 commits into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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