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