From 053140c8be1e10ac9b127cfb47b5691e70dd26e0 Mon Sep 17 00:00:00 2001 From: Luc SORIGNET Date: Sat, 4 Apr 2026 22:23:47 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20correction=20du=20t=C3=A9l=C3=A9chargeme?= =?UTF-8?q?nt=20du=20fichier?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Front-End/src/utils/fileUrl.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Front-End/src/utils/fileUrl.js b/Front-End/src/utils/fileUrl.js index 379fb72..72edd31 100644 --- a/Front-End/src/utils/fileUrl.js +++ b/Front-End/src/utils/fileUrl.js @@ -27,5 +27,13 @@ export const getSecureFileUrl = (filePath) => { } } + // Décoder le chemin au cas où il est déjà URL-encodé (ex: %20 pour les espaces) + // puis ré-encoder proprement pour éviter le double encodage (%2520). + try { + filePath = decodeURIComponent(filePath); + } catch { + // Si le décodage échoue, le chemin n'était pas encodé : on le garde tel quel. + } + return `/api/download?path=${encodeURIComponent(filePath)}`; };