Skip to main content

Module content_disposition

Module content_disposition 

Source
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 attachment or inline, 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_filename crate