-
Notifications
You must be signed in to change notification settings - Fork 65
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
Support filename cleanup as per RFC-6266 #56
Comments
I am also having issues with letters like "é" when uploading a file. |
@vdboor can you please shine some light on this? I'm surprised this is not getting more attention. Or maybe everybody else only uses ascii for their filenames. |
Note that We ought to build a list of clients where this doesn't work to support our use case. Sadly I have note noted (and can't recall) my exact use case. @Chrescht by Apache did you mean Apache Benchmark, or Java Apache HttpClient, or something else? By the way, this is a relatively small project that seems to accept contributions. We can start by writing some (failing) e2e tests with e.g microsoft/playwright (this one allows computing suggested filename on the fly too). |
@asfaltboy I'm talking about the apache web server. The original error comes from Django not being able to handle the provided filname. I'm not asking about any user agents. My issue is with upload files named e.g. "carte d'identité", the letter é will cause trouble here because the default encoding won't know how to handle it. |
Sorry I still don't get it, do you mean you run a Django app behind Apache httpd server? And when a user requests a file download, the response's content-disposition header breaks the http server, or what? Can you describe your use case step-by step please 🙏 ? |
@asfaltboy of course, here you go:
Python 3.8.5 and Django 3.2 |
I think we're talking about two different issues, from the above it looks to be that you're having an error during the POST (as you mention while uploading), while my issues is about You may want to open a separate issue, and probably ought to include the error traceback to aid debugging. |
You're right, I opened a new ticket #69. |
I found myself writing custom logic to sanitize a filename that would be downloadable on major browsers and able to open it on any operating system. This value is then provided to the
content_disposition_filename
attribute of thePrivateStorageDetailView
class.Instead, I think
PrivateStorageDetailView._encode_filename_header
should take care of it instead. We can do this by stripping permitted tokens as per RFC6266. I found the rfc6266 package on PYPI does exactly that, so one option would be to use it and then call in onbuild_header
with the optionalfilename_compat
agument whenever we encounter an older browser (UA == MSIE enough ?)While this may seem like a purely selfish act, it would be lovely for us not to think about content disposition, and browser support, and header specifications at all when an awesome storage package such as this can do it for us 😄 !
The text was updated successfully, but these errors were encountered: