Skip to main content

fallback

Function fallback 

Source
pub fn fallback(data: &[u8]) -> &'static str
Expand description

What to call something nothing recognised.

An empty file is text/plain, which surprises people who expect application/x-zerosize: that name exists, and gio uses it, but nothing is registered to open it, so a desktop that answers with it has turned an empty .svg into a file with no application. This follows File::MimeInfo instead, which calls an empty file text — and an empty file with a known extension never reaches here at all, because the name is consulted first.

Otherwise the text test, because a shell script, a config file and a README with no extension are all openable by anything that takes text/plain, and calling them application/octet-stream closes that door for no reason.