Support filename cleanup as per RFC-6266
See original GitHub issueI 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 the PrivateStorageDetailView
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 on build_header
with the optional filename_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 😄 !
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (3 by maintainers)
Top GitHub Comments
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
PrivateStorageDetailView
which is the view that serves the download of the private file after it’s already been uploaded (it doesn’t even implement thepost
method).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.