From 46b8396f6fa178ae5518ec3e7abdc64d29a40770 Mon Sep 17 00:00:00 2001 From: alperozturk Date: Wed, 4 Sep 2024 15:23:16 +0200 Subject: [PATCH] Get parent file via id and check existence of parent file Signed-off-by: alperozturk --- .../owncloud/android/operations/RemoveFileOperation.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/owncloud/android/operations/RemoveFileOperation.java b/app/src/main/java/com/owncloud/android/operations/RemoveFileOperation.java index 87b7cbfa7a37..fbf02060d818 100644 --- a/app/src/main/java/com/owncloud/android/operations/RemoveFileOperation.java +++ b/app/src/main/java/com/owncloud/android/operations/RemoveFileOperation.java @@ -19,6 +19,7 @@ import com.owncloud.android.lib.common.operations.RemoteOperation; import com.owncloud.android.lib.common.operations.RemoteOperationResult; import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode; +import com.owncloud.android.lib.common.utils.Log_OC; import com.owncloud.android.lib.resources.files.RemoveFileRemoteOperation; import com.owncloud.android.operations.common.SyncOperation; import com.owncloud.android.utils.MimeTypeUtil; @@ -86,7 +87,11 @@ protected RemoteOperationResult run(OwnCloudClient client) { boolean localRemovalFailed = false; if (!onlyLocalCopy) { if (fileToRemove.isEncrypted()) { - OCFile parent = getStorageManager().getFileByPath(fileToRemove.getParentRemotePath()); + OCFile parent = getStorageManager().getFileById(fileToRemove.getParentId()); + if (parent == null) { + return new RemoteOperationResult(ResultCode.LOCAL_FILE_NOT_FOUND); + } + operation = new RemoveRemoteEncryptedFileOperation(fileToRemove.getRemotePath(), user, context,