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
UTF-8 compatibility fix broke serving filenames with spaces #26
Comments
And if somebody wants to see the difference between the versions, as it is just a bit of utf8 encoding: 629df02...master |
+1 I am also seeing problems with files with spaces |
Any suggestions on how to deal with this? I'm not 100% sure what needs to be done? It's been a while since I've done anything on this project. It actually looks like the latest version doesn't doing any utf8 encoding at all? https://github.com/johnsensible/django-sendfile/blob/master/sendfile/backends/nginx.py But I can see in @MRigal example that the filename appears to be URL encoded (e.g. %20 instead of a space). p.s. sorry for not replying to this sooner. This ticket appeared one day after the birth of my 2nd child. Still playing catchup... |
OK, I'll try to write a proper test and take a look at that in the next days. It doesn't seem that trivial, especially when willing to have Python 2 and 3 support. |
I've just put a fix in for this. It's currently just in the master branch. Am now encoding the filenames to utf8 bytes (as per http://stackoverflow.com/questions/2732268/django-unicode-filenames-with-ascii-headers), rather than using urlquote. I've updated the tests etc for this, but it would be good if people can actually try this out to make sure it does actually work... |
Once I know it's working I'll package up a new release for PyPi. |
Ok, think I'm just going to package this up and put it on PyPi then. |
Ok 0.3.7 is on PyPi now: |
Hi all,
Updating from 0.3.4 to 0.3.6, I had the bad surprise to see that it broke the support of files containing whitespaces.
The response of sendfile 0.3.4 for such a file was :
X-Accel-Redirect: /protected_files/1/files/Backup 2014-09-02-2.sqlbackup
Content-length: 70458
Content-Type: application/octet-stream
Content-Disposition: attachment; filename="Backup 2014-09-02-2.sqlbackup.zip"
And now (since 0.3.5) it is:
X-Accel-Redirect: /protected_files/1/files/Backup%202014-09-02-2.sqlbackup
Content-length: 70458
Content-Type: application/octet-stream
Content-Disposition: attachment; filename="Backup 2014-09-02-2.sqlbackup.zip"
Which makes the download fail...
Best,
Matthieu
The text was updated successfully, but these errors were encountered: