From 188d55b799ecc72e2054525a6623d1d793f65e9f Mon Sep 17 00:00:00 2001 From: Dinika Saxena Date: Fri, 16 Feb 2024 12:24:28 +0100 Subject: [PATCH] Remove double-encoding of resource id in revisions and copy buttons --- .../ResourceViewActionsContainer.tsx | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/src/shared/containers/ResourceViewActionsContainer.tsx b/src/shared/containers/ResourceViewActionsContainer.tsx index ab63232d5..139ea6791 100644 --- a/src/shared/containers/ResourceViewActionsContainer.tsx +++ b/src/shared/containers/ResourceViewActionsContainer.tsx @@ -45,7 +45,6 @@ const ResourceViewActionsContainer: React.FC<{ orgLabel: string; projectLabel: string; }> = ({ resource, orgLabel, projectLabel, latestResource, isLatest }) => { - const encodedResourceId = encodeURIComponent(resource['@id']); const nexus = useNexusContext(); const history = useHistory(); const location = useLocation(); @@ -131,6 +130,7 @@ const ResourceViewActionsContainer: React.FC<{ const [view, setView] = React.useState(null); const subapp = useOrganisationsSubappContext(); React.useEffect(() => { + const encodedResourceId = encodeURIComponent(resource['@id']); nexus.Resource.tags(orgLabel, projectLabel, encodedResourceId).then( data => { setTags(data); @@ -194,7 +194,7 @@ const ResourceViewActionsContainer: React.FC<{ { - goToResource(orgLabel, projectLabel, encodedResourceId, rev); + goToResource(orgLabel, projectLabel, resource['@id'], rev); }} > Revision {rev} @@ -305,7 +305,7 @@ const ResourceViewActionsContainer: React.FC<{ { orgLabel, projectLabel, - resourceId: encodedResourceId, + resourceId: resource['@id'], } )}`; @@ -324,13 +324,14 @@ const ResourceViewActionsContainer: React.FC<{ overlay={ { const pathToResource = `${basePath}${generatePath( '/:orgLabel/:projectLabel/resources/:resourceId', { orgLabel, projectLabel, - resourceId: encodedResourceId, + resourceId: resource['@id'], } )}`; @@ -342,13 +343,14 @@ const ResourceViewActionsContainer: React.FC<{ Fusion URL { const pathToResource = `${basePath}${generatePath( '/:orgLabel/:projectLabel/resources/:resourceId', { orgLabel, projectLabel, - resourceId: encodedResourceId, + resourceId: resource['@id'], } )}`; @@ -361,20 +363,28 @@ const ResourceViewActionsContainer: React.FC<{ > Fusion URL (with revision) - triggerCopy(resource['@id'])}> + triggerCopy(resource['@id'])} + key="resource-id" + > Resource ID triggerCopy(`${resource['@id']}?rev=${resource._rev}`) } > Resource ID (with revision) - triggerCopy(self ? self : '')}> + triggerCopy(self ? self : '')} + key="nexus-api-endpoint" + > Nexus API endpoint triggerCopy( self