From a8ea2ddbd885877e0e560903f84a71f829c820ce Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 26 Jul 2018 13:04:24 +0200 Subject: [PATCH] fix #837, add an extra check to make sure bin files are restoring properly --- .../com/simplemobiletools/gallery/extensions/Activity.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/Activity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/Activity.kt index 47dbf2d84..7ea8421e2 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/Activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/Activity.kt @@ -236,7 +236,9 @@ fun BaseSimpleActivity.restoreRecycleBinPaths(paths: ArrayList, callback out = getFileOutputStreamSync(destination, source.getMimeType()) inputStream = getFileInputStreamSync(source)!! inputStream.copyTo(out!!) - mediumDao.updateDeleted(destination, 0) + if (File(source).length() == File(destination).length()) { + mediumDao.updateDeleted(destination, 0) + } } catch (e: Exception) { showErrorToast(e) } finally {