Comments (7)
Hmmm. Well it appears that the trouble is that Django is trying to convert the filename to ascii.
Looks like I probably just need to url encode the file name, before setting in the the header:
http://stackoverflow.com/questions/2732268/django-unicode-filenames-with-ascii-headers
Will hopefully get round to this later - unless you fancy submitting a pull request?
from django-sendfile.
Ok, I'm trying it, if it works, I submit a pull request.
from django-sendfile.
Hoped it was that simple.
File "/home/gunicorn/prod/ama/venv/lib/python2.6/site-packages/sendfile/__init__.py", line 59, in sendfile
response = _sendfile(request, filename.encode('utf-8'), mimetype=mimetype)
File "/home/gunicorn/prod/ama/venv/lib/python2.6/site-packages/sendfile/backends/nginx.py", line 7, in sendfile
response['X-Accel-Redirect'] = _convert_file_to_url(filename)
File "/home/gunicorn/prod/ama/venv/lib/python2.6/site-packages/sendfile/backends/_internalredirect.py", line 13, in _convert_file_to_url
return u'/'.join(url)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 1: ordinal not in range(128)
from django-sendfile.
(the worse part is that those accentuated characters used to be in extended ASCII)
from django-sendfile.
Ok do you want to give that a go? I've added some tests to check for unicode characters and encode them properly to master.
from django-sendfile.
It's great, I tested it in my use-case, it works.
Thanks a lot.
from django-sendfile.
Ok good. It's also on PyPI now, so should be pip installable.
from django-sendfile.
Related Issues (20)
- mod_wsgi backend broken on Django 1.8 HOT 9
- Our abc.tar.gz file sent using this django-sendfile was automatically getting unzipped by the browser
- Release 0.3.8 HOT 2
- Licensing HOT 4
- Problem with unicode characters HOT 10
- PyPi page looks strange HOT 2
- Is status really "Beta"? HOT 5
- Content-Disposition: Output contains buffer repr (Python 3.4) HOT 1
- Django 1.9 support HOT 4
- How to make "private" media accessible by site staff? HOT 1
- Add tests running in CI
- Support wheel packaging
- Serve a folder with sendfile
- Simple backend will decompress file HOT 1
- Maintaining the project HOT 12
- Apache 2.4 EnableSendfile as a potential replacement for XSendfile HOT 3
- I have to append `media/` to the path to not get a 404
- How to override the image url / path?
- Django 2.1 and above has removed the permalink() decorator HOT 1
- Please redirect to django-sendfile2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-sendfile.