diff --git a/src/CoreBundle/Controller/ResourceController.php b/src/CoreBundle/Controller/ResourceController.php index 2256f816b0..1b00956a4e 100644 --- a/src/CoreBundle/Controller/ResourceController.php +++ b/src/CoreBundle/Controller/ResourceController.php @@ -456,7 +456,7 @@ class ResourceController extends AbstractResourceController implements CourseCon /** * @return mixed|StreamedResponse */ - private function processFile(Request $request, ResourceNode $resourceNode, string $mode = 'show', string $filter = '', ?array $allUserInfo = null) + private function processFile(Request $request, ResourceNode $resourceNode, string $mode = 'show', string $filter = '', ?array $allUserInfo = null): mixed { $this->denyAccessUnlessGranted( ResourceNodeVoter::VIEW, @@ -554,9 +554,6 @@ class ResourceController extends AbstractResourceController implements CourseCon $content = str_replace('', $links.'', $content); } $response->setContent($content); - /*$contents = $this->renderView('@ChamiloCore/Resource/view_html.twig', [ - 'category' => '...', - ]);*/ return $response; } @@ -572,7 +569,9 @@ class ResourceController extends AbstractResourceController implements CourseCon } ); - // Transliterator::transliterate($fileName) + // Convert the file name to ASCII using iconv + $fileName = iconv('UTF-8', 'ASCII//TRANSLIT//IGNORE', $fileName); + $disposition = $response->headers->makeDisposition( $forceDownload ? ResponseHeaderBag::DISPOSITION_ATTACHMENT : ResponseHeaderBag::DISPOSITION_INLINE, $fileName