From 5d6942ae00a5507ae306a1a390308a68de8dc86e Mon Sep 17 00:00:00 2001 From: Manuel Zedel Date: Thu, 30 May 2024 15:49:55 +0200 Subject: [PATCH 1/2] fix: fixed an issue that prevented accessing releases with routing relevant symbols in their name Ticket: MEN-7209 Changelog: Title Signed-off-by: Manuel Zedel --- src/js/components/releases/releasedetails.js | 5 +++-- src/js/utils/locationutils.js | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/js/components/releases/releasedetails.js b/src/js/components/releases/releasedetails.js index 2e97ea3a17..edd5dfd413 100644 --- a/src/js/components/releases/releasedetails.js +++ b/src/js/components/releases/releasedetails.js @@ -52,6 +52,7 @@ import { removeArtifact, removeRelease, selectRelease, setReleaseTags, updateRel import { DEPLOYMENT_ROUTES } from '../../constants/deploymentConstants'; import { FileSize, customSort, formatTime, toggle } from '../../helpers'; import { getReleaseListState, getReleaseTags, getSelectedRelease, getUserCapabilities } from '../../selectors'; +import { generateReleasesPath } from '../../utils/locationutils'; import useWindowSize from '../../utils/resizehook'; import ChipSelect from '../common/chipselect'; import { ConfirmationButtons, EditButton } from '../common/confirm'; @@ -396,8 +397,8 @@ export const ReleaseDetails = () => { const onRemoveArtifact = artifact => dispatch(removeArtifact(artifact.id)).finally(() => setShowRemoveArtifactDialog(false)); const copyLinkToClipboard = () => { - const location = window.location.href.substring(0, window.location.href.indexOf('/releases') + '/releases'.length); - copy(`${location}/${releaseName}`); + const location = window.location.href.substring(0, window.location.href.indexOf('/releases')); + copy(`${location}${generateReleasesPath({ pageState: { selectedRelease: releaseName } })}`); dispatch(setSnackbar('Link copied to clipboard')); }; diff --git a/src/js/utils/locationutils.js b/src/js/utils/locationutils.js index bc48376883..c4f822d1c7 100644 --- a/src/js/utils/locationutils.js +++ b/src/js/utils/locationutils.js @@ -396,14 +396,15 @@ export const formatReleases = ({ pageState: { searchTerm, selectedTags = [], tab ) .join('&'); -export const generateReleasesPath = ({ pageState: { selectedRelease } }) => `${releasesRoot}${selectedRelease ? `/${selectedRelease}` : ''}`; +export const generateReleasesPath = ({ pageState: { selectedRelease } }) => + `${releasesRoot}${selectedRelease ? `/${encodeURIComponent(selectedRelease)}` : ''}`; export const parseReleasesQuery = (queryParams, extraProps) => { const name = queryParams.has('name') ? queryParams.get('name') : ''; const tab = queryParams.has('tab') ? queryParams.get('tab') : undefined; const tags = queryParams.has('tag') ? queryParams.getAll('tag') : []; const type = queryParams.has('type') ? queryParams.get('type') : ''; - let selectedRelease = extraProps.location.pathname.substring(releasesRoot.length + 1); + let selectedRelease = decodeURIComponent(extraProps.location.pathname.substring(releasesRoot.length + 1)); if (!selectedRelease && extraProps.pageState.id?.length) { selectedRelease = extraProps.pageState.id[0]; } From 39a6971936d0c9eea637bb0b12a1359058be866c Mon Sep 17 00:00:00 2001 From: Manuel Zedel Date: Thu, 30 May 2024 15:50:45 +0200 Subject: [PATCH 2/2] fix: fixed an issue that prevented the release name explanation tooltip from showing Ticket: None Changelog: None Signed-off-by: Manuel Zedel --- .../dialogs/__snapshots__/artifactinformationform.test.js.snap | 3 +-- src/js/components/releases/dialogs/artifactinformationform.js | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/js/components/releases/dialogs/__snapshots__/artifactinformationform.test.js.snap b/src/js/components/releases/dialogs/__snapshots__/artifactinformationform.test.js.snap index 13baaa3d57..ed37e90bad 100644 --- a/src/js/components/releases/dialogs/__snapshots__/artifactinformationform.test.js.snap +++ b/src/js/components/releases/dialogs/__snapshots__/artifactinformationform.test.js.snap @@ -935,10 +935,9 @@ label+.emotion-16 { class="MuiFormControl-root emotion-4" >