From 7f0f6739e0933ad7121c07246de8c5748d3dc16e Mon Sep 17 00:00:00 2001 From: Marie Gauthier Date: Tue, 10 Sep 2024 09:53:53 +0200 Subject: [PATCH] fix: APP-316 decoding file URLs (#2462) --- .../components/organisms/PostFiles/components/FilePreview.tsx | 2 +- .../src/components/organisms/EditFileForm/EditFileForm.tsx | 2 +- web-marketplace/src/components/organisms/PostForm/PostForm.tsx | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/web-components/src/components/organisms/PostFiles/components/FilePreview.tsx b/web-components/src/components/organisms/PostFiles/components/FilePreview.tsx index e4c301b61f..5f42009d1c 100644 --- a/web-components/src/components/organisms/PostFiles/components/FilePreview.tsx +++ b/web-components/src/components/organisms/PostFiles/components/FilePreview.tsx @@ -52,7 +52,7 @@ const FilePreview = ({ className={className} sx={theme => ({ position: 'relative', - background: `${image ? `url(${url})` : `${theme.palette.grey[100]}`}`, + background: `${image ? `url("${url}")` : `${theme.palette.grey[100]}`}`, backgroundSize: 'contain', backgroundRepeat: 'no-repeat', backgroundPosition: 'center', diff --git a/web-marketplace/src/components/organisms/EditFileForm/EditFileForm.tsx b/web-marketplace/src/components/organisms/EditFileForm/EditFileForm.tsx index 447109e3c7..d7bb4dc9ce 100644 --- a/web-marketplace/src/components/organisms/EditFileForm/EditFileForm.tsx +++ b/web-marketplace/src/components/organisms/EditFileForm/EditFileForm.tsx @@ -80,7 +80,7 @@ export const EditFileForm = ({ className="block m-auto pb-40 sm:pb-50" width="180px" height="100%" - src={url} + src={decodeURI(url)} alt="preview" /> )} diff --git a/web-marketplace/src/components/organisms/PostForm/PostForm.tsx b/web-marketplace/src/components/organisms/PostForm/PostForm.tsx index 945aec0aa3..2c839b5ed2 100644 --- a/web-marketplace/src/components/organisms/PostForm/PostForm.tsx +++ b/web-marketplace/src/components/organisms/PostForm/PostForm.tsx @@ -137,7 +137,7 @@ export const PostForm = ({ mimeType: '', }); } - if (value) setValue(`files.${fieldIndex}.url`, encodeURI(value)); + if (value) setValue(`files.${fieldIndex}.url`, decodeURI(value)); if (mimeType) setValue(`files.${fieldIndex}.mimeType`, mimeType); if (name) setValue(`files.${fieldIndex}.name`, name); if (iri) setValue(`files.${fieldIndex}.iri`, iri);