diff --git a/backend/app/functions/routing.php b/backend/app/functions/routing.php index d5e70dc..37ecc04 100644 --- a/backend/app/functions/routing.php +++ b/backend/app/functions/routing.php @@ -4,14 +4,19 @@ function routing_static_files() { $requestUri = $_SERVER['REQUEST_URI'] ?? ''; $path = parse_url($requestUri, PHP_URL_PATH); + $path = urldecode($path); // декодируем кириллицу из URL // Отдача файлов из /public/ (принудительное скачивание) if (strpos($path, '/public/') === 0) { $file = dirname(dirname(__DIR__)) . $path; if (is_file($file)) { + $filename = basename($file); + $filename_encoded = rawurlencode($filename); + header('Content-Type: application/octet-stream'); header('Content-Length: ' . filesize($file)); - header('Content-Disposition: attachment; filename="' . basename($file) . '"'); + // RFC 5987: filename* для кириллицы, filename для fallback + header("Content-Disposition: attachment; filename=\"$filename\"; filename*=UTF-8''$filename_encoded"); readfile($file); exit; }