fix: correction du téléchargement du fichier

This commit is contained in:
Luc SORIGNET
2026-04-04 22:23:47 +02:00
parent 90b0d14418
commit 053140c8be

View File

@ -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)}`; return `/api/download?path=${encodeURIComponent(filePath)}`;
}; };