mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-22 20:48:00 +01:00
make sure we clean up invalid recycle bin db entries
This commit is contained in:
parent
59cb293d98
commit
ed8fa63ce8
1 changed files with 6 additions and 1 deletions
|
@ -364,8 +364,13 @@ 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 {
|
||||
mediumDao.deleteMediumPath(it.path)
|
||||
if (it.path.startsWith(recycleBinPath)) {
|
||||
mediumDao.deleteMediumPath(it.path.removePrefix(recycleBinPath))
|
||||
} else {
|
||||
mediumDao.deleteMediumPath(it.path)
|
||||
}
|
||||
}
|
||||
}.start()
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue