Skip to main content

content_type

Function content_type 

Source
fn content_type(path: &Path, head: &[u8]) -> &'static str
Expand description

Guess a content type.

Magic bytes win over the extension. Downloading at original quality asks Jellyfin for a direct static copy, which returns the source file’s bytes under a .mp4 name whatever the real container is — a downloaded film named .mp4 turned out to be an AVI holding XVID. Trusting the extension there labels it video/mp4 and the player is handed a container that is not what the header claims. The extension is only a fallback for a file whose bytes are unrecognised, and for the extension-less files the offline queue writes under an item id.

TRACES: UR-071 | DR-137 | UT-127