You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I struggled to get Unicode filenames to work when serving with X-Sendfile via Apache. (Where it worked in the development server.) This was with Python 2 (and Django 1.11). I haven't tested with later versions.
It turned out that when setting a header on a django.http.HttpResponse object to a Unicode string the value instead became a str object which didn't work well when the response object was later used. It works for me by just changing response['X-Sendfile'] = private_file.full_path (which was a unicode) by adding .encode('utf-8') to the end of it in serve in ApacheXSendFileServer in servers.py.
This is the quick fix for me (except it really wasn't quick :-) which might need embellishing to work with different versions and maybe to check what the actual encoding of filenames should be, but hopefully useful as a start or as something to copy for others with the same problem.
The text was updated successfully, but these errors were encountered:
I struggled to get Unicode filenames to work when serving with X-Sendfile via Apache. (Where it worked in the development server.) This was with Python 2 (and Django 1.11). I haven't tested with later versions.
It turned out that when setting a header on a django.http.HttpResponse object to a Unicode string the value instead became a str object which didn't work well when the response object was later used. It works for me by just changing
response['X-Sendfile'] = private_file.full_path
(which was a unicode) by adding.encode('utf-8')
to the end of it inserve
inApacheXSendFileServer
inservers.py
.This is the quick fix for me (except it really wasn't quick :-) which might need embellishing to work with different versions and maybe to check what the actual encoding of filenames should be, but hopefully useful as a start or as something to copy for others with the same problem.
The text was updated successfully, but these errors were encountered: