Skip to content

Commit 774d8c5

Browse files
committed
AbstractOnServerIT file deletion now ignores non-empty encrypted folders
TODO: helper function to check mime type for folder should probably move to the RemoteFile class in the Nextcloud Library. Signed-off-by: Philipp Hasper <[email protected]>
1 parent 880b982 commit 774d8c5

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

app/src/androidTest/java/com/owncloud/android/AbstractOnServerIT.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
import com.owncloud.android.lib.resources.files.model.RemoteFile;
3737
import com.owncloud.android.operations.RefreshFolderOperation;
3838
import com.owncloud.android.operations.UploadFileOperation;
39+
import com.owncloud.android.utils.MimeType;
3940

4041
import org.apache.commons.httpclient.HttpStatus;
4142
import org.apache.commons.httpclient.methods.GetMethod;
@@ -127,6 +128,11 @@ public void after() {
127128
super.after();
128129
}
129130

131+
private static boolean isFolder(RemoteFile file) {
132+
// TODO: should probably move to RemoteFile class
133+
return MimeType.DIRECTORY.equals(file.getMimeType()) || MimeType.WEBDAV_FOLDER.equals(file.getMimeType());
134+
}
135+
130136
public static void deleteAllFilesOnServer() {
131137
RemoteOperationResult result = new ReadFolderRemoteOperation("/").execute(client);
132138
assertTrue(result.getLogMessage(), result.isSuccess());
@@ -144,6 +150,13 @@ public static void deleteAllFilesOnServer() {
144150
.execute(client)
145151
.isSuccess();
146152

153+
if (!operationResult && isFolder(remoteFile)) {
154+
// Deleting encrypted folder is not possible due to bug
155+
// https://github.com/nextcloud/end_to_end_encryption/issues/421
156+
// Toggling encryption also fails, when the folder is not empty. So we ignore this folder
157+
continue;
158+
}
159+
147160
assertTrue(operationResult);
148161
}
149162

0 commit comments

Comments
 (0)