Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ef07a324 authored by tibbi's avatar tibbi
Browse files

add an extra check to avoid deleting folders from mediastore

parent ddab1bfd
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -334,6 +334,11 @@ fun Context.rescanDeletedPath(path: String, callback: (() -> Unit)? = null) {
    if (deleteFromMediaStore(path)) {
        callback?.invoke()
    } else {
        if (getDoesFilePathExist(path) || getIsPathDirectory(path)) {
            callback?.invoke()
            return
        }

        MediaScannerConnection.scanFile(applicationContext, arrayOf(path), null, { s, uri ->
            try {
                applicationContext.contentResolver.delete(uri, null, null)