Skip to content

Commit

Permalink
🐛 URL-encode ruleset and rule in affected apps page URL so it doesn't…
Browse files Browse the repository at this point in the history
… break when ruleset contains a slash (/) character (konveyor#1272)

Fixes an issue @ibolton336 identified where navigating to the affected
apps page from the issues page causes a broken URL if the issue's
ruleset contains a `/`.

Signed-off-by: Mike Turley <[email protected]>
  • Loading branch information
mturley authored Aug 9, 2023
1 parent e07b603 commit 5e9a715
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ interface IAffectedApplicationsRouteParams {
export const AffectedApplications: React.FC = () => {
const { t } = useTranslation();

const { ruleset, rule } = useParams<IAffectedApplicationsRouteParams>();
const routeParams = useParams<IAffectedApplicationsRouteParams>();
const ruleset = decodeURIComponent(routeParams.ruleset);
const rule = decodeURIComponent(routeParams.rule);
const issueTitle =
new URLSearchParams(useLocation().search).get("issueTitle") ||
"Active rule";
Expand Down
4 changes: 2 additions & 2 deletions client/src/app/pages/issues/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ export const getAffectedAppsUrl = ({
if (fromFilterValues[key]) toFilterValues[key] = fromFilterValues[key];
});
const baseUrl = Paths.issuesAllAffectedApplications
.replace("/:ruleset/", `/${ruleReport.ruleset}/`)
.replace("/:rule/", `/${ruleReport.rule}/`);
.replace("/:ruleset/", `/${encodeURIComponent(ruleReport.ruleset)}/`)
.replace("/:rule/", `/${encodeURIComponent(ruleReport.rule)}/`);
const prefix = (key: string) =>
`${TableURLParamKeyPrefix.issuesAffectedApps}:${key}`;
return `${baseUrl}?${trimAndStringifyUrlParams({
Expand Down

0 comments on commit 5e9a715

Please sign in to comment.