allow deletion of all files

This commit is contained in:
Daniel Gultsch 2022-03-10 12:39:43 +01:00
parent ceceead505
commit 56f01c29b9
2 changed files with 7 additions and 6 deletions

View file

@ -362,8 +362,12 @@ public class FileBackend {
} }
private static boolean weOwnFileLollipop(final Uri uri) { private static boolean weOwnFileLollipop(final Uri uri) {
final String path = uri.getPath();
if (path == null) {
return false;
}
try { try {
File file = new File(uri.getPath()); File file = new File(path);
FileDescriptor fd = FileDescriptor fd =
ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY) ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY)
.getFileDescriptor(); .getFileDescriptor();

View file

@ -1184,11 +1184,8 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
cancelTransmission.setVisible(true); cancelTransmission.setVisible(true);
} }
if (m.isFileOrImage() && !deleted && !cancelable) { if (m.isFileOrImage() && !deleted && !cancelable) {
final String path = m.getRelativeFilePath(); deleteFile.setVisible(true);
if (path == null || !path.startsWith("/")) { deleteFile.setTitle(activity.getString(R.string.delete_x_file, UIHelper.getFileDescriptionString(activity, m)));
deleteFile.setVisible(true);
deleteFile.setTitle(activity.getString(R.string.delete_x_file, UIHelper.getFileDescriptionString(activity, m)));
}
} }
if (showError) { if (showError) {
showErrorMessage.setVisible(true); showErrorMessage.setVisible(true);