fix: Properly surround filename in quotation marks

Signed-off-by: Myzel394 <50424412+Myzel394@users.noreply.github.com>
This commit is contained in:
Myzel394 2024-07-25 20:50:21 +02:00
parent 8cd2fa3b76
commit 73e99afadc
No known key found for this signature in database
GPG Key ID: DEC4AAB876F73185

View File

@ -419,11 +419,25 @@ abstract class BatchesFolder(
}
}
context.contentResolver.delete(
scopedMediaContentUri,
"${MediaStore.MediaColumns.DISPLAY_NAME} IN (${deletableNames.joinToString(",")})",
null,
)
try {
context.contentResolver.delete(
scopedMediaContentUri,
"${MediaStore.MediaColumns.DISPLAY_NAME} IN (${
deletableNames.joinToString(
","
) { "'$it'" }
})",
null,
)
// This is unfortunate if the files can't be deleted, but let's just
// ignore it since we can't do anything about it
} catch (e: RuntimeException) {
// Probably file not found
e.printStackTrace()
} catch (e: IllegalArgumentException) {
// Strange filename, should not happen
e.printStackTrace()
}
} else {
// TODO: Fix "would you like to try saving" -> Save button
legacyMediaFolder.listFiles()?.forEach {