make sure we clean up invalid recycle bin db entries

This commit is contained in:
tibbi 2018-06-27 15:20:45 +02:00
parent 59cb293d98
commit ed8fa63ce8
1 changed files with 6 additions and 1 deletions

View File

@ -364,9 +364,14 @@ fun Context.getCachedMedia(path: String, getVideosOnly: Boolean = false, getImag
val grouped = mediaFetcher.groupMedia(media, path)
callback(grouped.clone() as ArrayList<ThumbnailItem>)
val recycleBinPath = filesDir.toString()
media.filter { !getDoesFilePathExist(it.path) }.forEach {
if (it.path.startsWith(recycleBinPath)) {
mediumDao.deleteMediumPath(it.path.removePrefix(recycleBinPath))
} else {
mediumDao.deleteMediumPath(it.path)
}
}
}.start()
}