diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/Context.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/Context.kt index 7b8195b7d..086102b1e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/Context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/Context.kt @@ -364,8 +364,13 @@ fun Context.getCachedMedia(path: String, getVideosOnly: Boolean = false, getImag val grouped = mediaFetcher.groupMedia(media, path) callback(grouped.clone() as ArrayList) + val recycleBinPath = filesDir.toString() media.filter { !getDoesFilePathExist(it.path) }.forEach { - mediumDao.deleteMediumPath(it.path) + if (it.path.startsWith(recycleBinPath)) { + mediumDao.deleteMediumPath(it.path.removePrefix(recycleBinPath)) + } else { + mediumDao.deleteMediumPath(it.path) + } } }.start() }