restored metadata-extractor tiff detection false positive workaround

This commit is contained in:
Thibault Deckers 2020-11-15 10:56:00 +09:00
parent ad8e5253fd
commit 79f8fa7f71

View file

@ -222,11 +222,14 @@ class MetadataHandler(private val context: Context) : MethodCallHandler {
// * file extension is unreliable // * file extension is unreliable
// In the end, `metadata-extractor` is the most reliable, except for `tiff` (false positives, false negatives), // In the end, `metadata-extractor` is the most reliable, except for `tiff` (false positives, false negatives),
// in which case we trust the file extension // in which case we trust the file extension
// cf https://github.com/drewnoakes/metadata-extractor/issues/296
if (path?.matches(tiffExtensionPattern) == true) { if (path?.matches(tiffExtensionPattern) == true) {
metadataMap[KEY_MIME_TYPE] = MimeTypes.TIFF metadataMap[KEY_MIME_TYPE] = MimeTypes.TIFF
} else { } else {
dir.getSafeString(FileTypeDirectory.TAG_DETECTED_FILE_MIME_TYPE) { dir.getSafeString(FileTypeDirectory.TAG_DETECTED_FILE_MIME_TYPE) {
metadataMap[KEY_MIME_TYPE] = it if (it != MimeTypes.TIFF) {
metadataMap[KEY_MIME_TYPE] = it
}
} }
} }
} }