Skip to content

Commit 5096dea

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 7284374 commit 5096dea

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
@@ -35,6 +35,7 @@
3535
import com.owncloud.android.lib.resources.files.model.RemoteFile;
3636
import com.owncloud.android.operations.RefreshFolderOperation;
3737
import com.owncloud.android.operations.UploadFileOperation;
38+
import com.owncloud.android.utils.MimeType;
3839

3940
import org.apache.commons.httpclient.HttpStatus;
4041
import org.apache.commons.httpclient.methods.GetMethod;
@@ -129,6 +130,11 @@ public void after() {
129130
super.after();
130131
}
131132

133+
private static boolean isFolder(RemoteFile file) {
134+
// TODO: should probably move to RemoteFile class
135+
return MimeType.DIRECTORY.equals(file.getMimeType()) || MimeType.WEBDAV_FOLDER.equals(file.getMimeType());
136+
}
137+
132138
public static void deleteAllFilesOnServer() {
133139
RemoteOperationResult result = new ReadFolderRemoteOperation("/").execute(client);
134140
assertTrue(result.getLogMessage(), result.isSuccess());
@@ -146,6 +152,13 @@ public static void deleteAllFilesOnServer() {
146152
.execute(client)
147153
.isSuccess();
148154

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

0 commit comments

Comments
 (0)