Skip to content

Commit

Permalink
Merge pull request #781 from SSWConsulting:fix-compare-scan
Browse files Browse the repository at this point in the history
Fixed comparing scan directing to 404 page
  • Loading branch information
zacharykeeping committed Nov 23, 2023
2 parents 1e0f63b + e9b4c27 commit 08aca9e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ui/src/containers/ScanCompare.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import LoadingFlat from "../components/misccomponents/LoadingFlat.svelte";
import { navigateTo } from "svelte-router-spa";
import Breadcrumbs from "../components/misccomponents/Breadcrumbs.svelte";
import { revertSpecialCharUrl } from "../utils/utils";
export let currentRoute;
let allScans = [];
Expand All @@ -16,7 +17,7 @@
onMount(async () => {
allScans = await getAllScanSummaryFromUrl(
currentRoute.namedParams.api,
currentRoute.namedParams.url
revertSpecialCharUrl(currentRoute.namedParams.url)
);
if (allScans.length > 0) {
Expand Down
9 changes: 9 additions & 0 deletions ui/src/utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,15 @@ export const convertSpecialCharUrl = (url) => {
return url.replace(/[:/]/g, m => specialChars[m]);
};

export const revertSpecialCharUrl = (url) => {
// Replace special characters in URL string
const specialChars = {
'%3A' : ':',
'%2F' : '/'
};
return url.replace(/%3A|%2F/gi, (matched) => specialChars[matched]);
};

export const RuleType = {
Warning: "Warning",
Error: "Error",
Expand Down

0 comments on commit 08aca9e

Please sign in to comment.