From cd070271921dd3191d1e3c51b631d9a2f999d5cf Mon Sep 17 00:00:00 2001 From: Andreas Date: Mon, 21 Mar 2022 18:13:39 +0100 Subject: [PATCH] Use the file extension from the ImageType enum (#6800) * Use the file extension from the ImageType enum * Use the mime type from the ImageType enum - On Android 29+ --- app/src/main/java/eu/kanade/tachiyomi/data/saver/ImageSaver.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/saver/ImageSaver.kt b/app/src/main/java/eu/kanade/tachiyomi/data/saver/ImageSaver.kt index 7ef07da6b0..be6af8cca4 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/saver/ImageSaver.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/saver/ImageSaver.kt @@ -28,7 +28,7 @@ class ImageSaver( val data = image.data val type = ImageUtil.findImageType(data) ?: throw Exception("Not an image") - val filename = DiskUtil.buildValidFilename("${image.name}.$type") + val filename = DiskUtil.buildValidFilename("${image.name}.${type.extension}") if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) { return save(data(), image.location.directory(context), filename) @@ -43,6 +43,7 @@ class ImageSaver( val contentValues = ContentValues().apply { put(MediaStore.Images.Media.DISPLAY_NAME, image.name) + put(MediaStore.Images.Media.MIME_TYPE, type.mime) put( MediaStore.Images.Media.RELATIVE_PATH, "${Environment.DIRECTORY_PICTURES}/${context.getString(R.string.app_name)}/" +