Expand description
HTTP content-disposition selection and filename sanitization.
Media types are checked against the safe-inline list before selecting a disposition. Optional filenames are sanitized before header construction.
Constants§
- ALLOWED_
INLINE_ 🔒CONTENT_ TYPES - as defined by MSC2702
Functions§
- content_
disposition_ type - Returns a Content-Disposition of
attachmentorinline, depending on the Content-Type against MSC2702 list of safe inline Content-Types (ALLOWED_INLINE_CONTENT_TYPES) - content_
type_ essence - The media type of a Content-Type, without its parameters.
- content_
type_ is - Whether a Content-Type names the given media type.
- make_
content_ disposition - creates the final Content-Disposition based on whether the filename exists or not, or if a requested filename was specified (media download with filename)
- sanitise_
filename - sanitises the file name for the Content-Disposition using
sanitize_filenamecrate