From d31ba4b3e6313b6f46a1f41738a978fa78c949d9 Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Tue, 14 Jun 2022 07:39:22 +0200 Subject: [PATCH] Only allow folder to unset if not in e2e subtree Signed-off-by: tobiasKaminsky --- .../com/owncloud/android/files/FileMenuFilter.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/owncloud/android/files/FileMenuFilter.java b/app/src/main/java/com/owncloud/android/files/FileMenuFilter.java index 1f8e301f09..e214c66c2f 100644 --- a/app/src/main/java/com/owncloud/android/files/FileMenuFilter.java +++ b/app/src/main/java/com/owncloud/android/files/FileMenuFilter.java @@ -319,8 +319,8 @@ public class FileMenuFilter { } private void filterUnsetEncrypted(List toShow, List toHide, boolean endToEndEncryptionEnabled) { - if (files.isEmpty() || !isSingleSelection() || isSingleFile() || !isEncryptedFolder() - || !endToEndEncryptionEnabled) { + if (files.isEmpty() || !isSingleSelection() || isSingleFile() || !isEncryptedFolder() || hasEncryptedParent() + || !endToEndEncryptionEnabled) { toHide.add(R.id.action_unset_encrypted); } else { toShow.add(R.id.action_unset_encrypted); @@ -550,6 +550,13 @@ public class FileMenuFilter { return files.iterator().next().isGroupFolder(); } + private boolean hasEncryptedParent() { + OCFile folder = files.iterator().next(); + OCFile parent = componentsGetter.getStorageManager().getFileById(folder.getParentId()); + + return parent != null && parent.isEncrypted(); + } + private boolean isSingleImage() { return isSingleSelection() && MimeTypeUtil.isImage(files.iterator().next()); }