From 69c50a01ad3c1f0c07a02c975e5d9665e49bffe2 Mon Sep 17 00:00:00 2001 From: boffart <5922739+boffart@users.noreply.github.com> Date: Wed, 22 Jul 2026 17:51:01 +0300 Subject: [PATCH] fix: preserve unicode recording names on PHP 7.4 --- Lib/DownloadHeaderPolicy.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Lib/DownloadHeaderPolicy.php b/Lib/DownloadHeaderPolicy.php index 8cf908b..26ee2e3 100644 --- a/Lib/DownloadHeaderPolicy.php +++ b/Lib/DownloadHeaderPolicy.php @@ -8,7 +8,10 @@ final class DownloadHeaderPolicy { public static function attachment(string $filename): string { - $clean = str_replace(["\r", "\n", '"', "\0"], '', basename($filename)); + $normalized = str_replace('\\', '/', $filename); + $separator = strrpos($normalized, '/'); + $basename = $separator === false ? $normalized : substr($normalized, $separator + 1); + $clean = str_replace(["\r", "\n", '"', "\0"], '', $basename); if ($clean === '') { $clean = 'download'; }