Skip to content

Commit d5aa82a

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 e7fea75 commit d5aa82a

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;
@@ -130,6 +131,11 @@ public void after() {
130131
super.after();
131132
}
132133

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

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

0 commit comments

Comments
 (0)