-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Fixes #13919, make response->setFileToSend support non-ASCII filename. #14333
Conversation
4.0.0-alpha.5
4.0.0-beta.1
v4.0.0-beta.2
Thank you for the pull. We're not accepting pulls on the master. Can you sent into the 4.0.x branch and would it be possible to add some unit tests? |
I am not sure about how to make a right unit test, because the it only affect the response header. |
Apply sugguestion Co-Authored-By: Serghei Iakovlev <sergeyklay@users.noreply.github.com>
Codecov Report
@@ Coverage Diff @@
## 4.0.x #14333 +/- ##
==========================================
- Coverage 66.31% 66.31% -0.01%
==========================================
Files 488 488
Lines 115910 115927 +17
==========================================
+ Hits 76862 76873 +11
- Misses 39048 39054 +6 |
Apply sugguestion Co-Authored-By: Serghei Iakovlev <sergeyklay@users.noreply.github.com>
apply sugguestion Co-Authored-By: Serghei Iakovlev <sergeyklay@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you run phpcs to fix the code style? See failing test
https://travis-ci.org/phalcon/cphalcon/jobs/577361625
sorry for the code style issue. I don't have a fullly configured develop environment and missed the code style check. |
Take note that the semicolon at the end of the header is still not allowed according to http://test.greenbytes.de/tech/tc2231/#attwithasciifilenamenqs.
|
The trailing semicolon makes the header field value syntactically incorrect, as no other parameter follows. Thus the header field should be ignored. from: @StudioMaX
@ian4hu could you test these changes with the all common browsers with ASCII/non-ASCII filenames? I may be wrong, but the file name should still be in double quotes, as the file name may contain spaces (see http://test.greenbytes.de/tech/tc2231/#attwithasciifilenamenqws). Also, filename in Maybe something like this: if basePathEncoding != "ASCII" {
this->setRawHeader("Content-Disposition: attachment; filename=\"" . basePath . "\"; filename*=". strtolower(basePathEncoding) . "''" . basePathEncoded);
} else {
this->setRawHeader("Content-Disposition: attachment; filename=\"" . basePath . "\"");
} |
Thank you |
I could not make a complete tests in http://test.greenbytes.de/tech/tc2231/#attwithasciifilenamenqws, I only have the main stream browser sets to test, which including latest Chrome, Firefox, Safari, IE or Edge, and because I am busy at work recently, I don't have time to test so I just make the header to follow RFC2231#Section 5. IMO, the RFC is the standard specific between browser and server. if I make the framework with browser specific behavior, then if the browser changed its behavior your framework may not work with it again. |
Your suggesstion about quoting is right. as the RFC mentioned: I will re-read the RFC and make some changes later. thanks. |
Hello!
In raising this pull request, I confirm the following:
Small description of change:
Add non-ASCII support
basename()
byPhalcon\Helper\Fs
and fixed the #13919Thanks