question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support filename cleanup as per RFC-6266

See original GitHub issue

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 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:open
  • Created 3 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
asfaltboycommented, Jun 11, 2021

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 the post method).

You may want to open a separate issue, and probably ought to include the error traceback to aid debugging.

0reactions
Chreschtcommented, Jun 11, 2021

You’re right, I opened a new ticket #69.

Read more comments on GitHub >

github_iconTop Results From Across the Web

RFC 6266 - Use of the Content-Disposition Header Field in ...
Reschke Standards Track [Page 1] RFC 6266 Content-Disposition in HTTP June ... user agents that do not support the RFC 5987 encoding ignore...
Read more >
File Upload Field - Documentation - Form Tools
Per -field file settings ... To customize the filename, you'll need to edit the Filename format ... The clean file string without the...
Read more >
c# - Asp .net server support for RFC 6266 and filename
MultiPartFormDataContent class correctly encodes characters in the uploaded filename and sends both filename and filename* keys as per RFC ...
Read more >
PathCleanupSpec function (shlobj_core.h) - Win32 apps
[PathCleanupSpec is available for use in the operating systems ... Enforces the 8.3 filename format on drives that do not support long file ......
Read more >
Folder Action for automatic file name cleanup - Ask Different
Using Automator, in macOS Sierra 10.12.5, I created a Folder Action with a single Run AppleScript action, using the AppleScript code below, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found