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

Commit c6129a88 authored by tibbi's avatar tibbi
Browse files

add an extra check at deleteFromMediaStore to avoid deleting existing files

parent a28e8b94
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -237,6 +237,10 @@ fun Context.getFileUri(path: String) = when {

// these functions update the mediastore instantly, MediaScannerConnection.scanFile takes some time to really get applied
fun Context.deleteFromMediaStore(path: String): Boolean {
    if (getDoesFilePathExist(path)) {
        return false
    }

    return try {
        val where = "${MediaStore.MediaColumns.DATA} = ?"
        val args = arrayOf(path)