Classify a file as one of FILE_TYPES (pdf/epub/mp3/mp4/webm), or null, using
its name (extension) and, if provided, its MIME type. Detection is
extension/MIME only (D13).
A KNOWN supported extension is authoritative: it classifies the file on its
own and a (possibly wrong/mislabelled) MIME can neither contradict it nor
reroute it to a different format — otherwise e.g. movie.mp4 served with a
stray audio/mpeg would be stored/served/played as mp3. Only when the
extension is unknown or absent do we fall back to classifying by MIME alone.
Classify a file as one of
FILE_TYPES(pdf/epub/mp3/mp4/webm), or null, using its name (extension) and, if provided, its MIME type. Detection is extension/MIME only (D13).A KNOWN supported extension is authoritative: it classifies the file on its own and a (possibly wrong/mislabelled) MIME can neither contradict it nor reroute it to a different format — otherwise e.g.
movie.mp4served with a strayaudio/mpegwould be stored/served/played as mp3. Only when the extension is unknown or absent do we fall back to classifying by MIME alone.