fix: adopt potentially changed file extension when downloading

This commit is contained in:
Björn Fromme
2025-04-23 15:43:23 +02:00
parent 3c57ff7af8
commit 190d6200ce
2 changed files with 15 additions and 1 deletions
@@ -59,6 +59,12 @@ class BatchDownloadController extends AbstractController
/** @var Upload $upload */
$filename = $upload->getOriginalFilename();
$filepath = $this->uploadHandler->getUploadFilepath($upload);
$extension = pathinfo($filepath, PATHINFO_EXTENSION);
// adopt potentially changed file extension
if (false === str_ends_with($filename, $extension)) {
$filename = $filename.'.'.$extension;
}
try {
$zip->addFileFromPath(fileName: $filename, path: $filepath);
@@ -79,4 +85,4 @@ class BatchDownloadController extends AbstractController
return $response;
}
}
}