From 4efdb1a47a8cc0fe5e640c34f7b16a8b0014846a Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 8 Nov 2017 23:40:19 +0100 Subject: [PATCH] fix saving rotated images on the internal storage --- .../simplemobiletools/gallery/activities/ViewPagerActivity.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt index b878c0d01..b7f0cdf4d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -541,7 +541,8 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View var inputStream: InputStream? = null var out: OutputStream? = null try { - out = getFileOutputStreamSync(destination.absolutePath, source.getMimeType(), getFileDocument(destination.parent)) + val fileDocument = if (isPathOnSD(destination.absolutePath)) getFileDocument(destination.parent) else null + out = getFileOutputStreamSync(destination.absolutePath, source.getMimeType(), fileDocument) inputStream = FileInputStream(source) inputStream.copyTo(out!!) } finally {