2

rfc6266 used to be the perfect tool for this job, but it is no longer working as of recently because of various issues. The latest fork fixes some of it, but still leaves some unaddressed. Such as the fact that LEPL, a package that rfc6266 depends on, has been abandoned and is no longer compliant with Python 3.5+.

So is there a clean and reliable method for parsing a Content-Disposition header that is still working today?

Note: see this question for issues that can't be easily solved (at least in my opinion) by using a quickly hacked together ad-hoc parser.

what the
  • 398
  • 3
  • 10

1 Answers1

0

You can use the parser from werkzeug to do this. Its not as thorough, but it does the trick for flask and quart. See: https://github.com/pallets/werkzeug/blob/main/src/werkzeug/http.py#L377