Resolve a file type. Precedence: a declaration (unless unambiguous bytes contradict it), then an unambiguous signature, then the extension (which beats an ambiguous signature — every .xlsx is a zip), then the source's default.
Resolve a file type. Precedence: a declaration (unless unambiguous bytes contradict it), then an unambiguous signature, then the extension (which beats an ambiguous signature — every .xlsx is a zip), then the source's default.