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.

Re-exportsยง

use ruma::http_headers::ContentDisposition; ๐Ÿ”’
use ruma::http_headers::ContentDispositionType; ๐Ÿ”’
use crate::debug_info; ๐Ÿ”’

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