Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.8] Fix Filesystem download non-ASCII fielname #28369

Closed
wants to merge 1 commit into from
Closed

[5.8] Fix Filesystem download non-ASCII fielname #28369

wants to merge 1 commit into from

Conversation

maliang
Copy link

@maliang maliang commented Apr 29, 2019

Fixed #2703#2305

@sisve
Copy link
Contributor

sisve commented Apr 30, 2019

This looks like something that could use a unit test to make sure it continues working in the future too.

@driesvints driesvints changed the title Fix Filesystem download non-ASCII fielname [5.8] Fix Filesystem download non-ASCII fielname Apr 30, 2019
@taylorotwell
Copy link
Member

taylorotwell commented Apr 30, 2019

I don't think this actually fixes anything? The basename of this file could still have UTF-8 characters? It's the end-users responsibility.

@4n70w4
Copy link
Contributor

4n70w4 commented May 16, 2019

@maliang that s work for me:

Index: vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php	(date 1558007947471)
+++ vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php	(date 1558007947471)
@@ -138,7 +138,7 @@
     {
         $response = new StreamedResponse;
 
-        $disposition = $response->headers->makeDisposition($disposition, $name ?? basename($path));
+        $disposition = $response->headers->makeDisposition($disposition, $name ?? basename($path), Str::ascii($name));
 
         $response->headers->replace($headers + [
             'Content-Type' => $this->mimeType($path),

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The filename fallback must only contain ASCII characters
4 participants