From 2bb2c086a8f9fcd6f81cddc860749f983f32649d Mon Sep 17 00:00:00 2001 From: vincent Bourgmayer Date: Fri, 6 May 2022 09:43:41 +0200 Subject: [PATCH 01/11] Add new UploadChunkedFileOperation - UploadFileOperation: make usage of an available variable in checkAvailableSpace(...) - Add UploadChunkedFileOperation base --- .../UploadChunkedFileOperation.java | 192 ++++++++++++++++++ .../drive/operations/UploadFileOperation.java | 2 +- 2 files changed, 193 insertions(+), 1 deletion(-) create mode 100644 app/src/main/java/foundation/e/drive/operations/UploadChunkedFileOperation.java diff --git a/app/src/main/java/foundation/e/drive/operations/UploadChunkedFileOperation.java b/app/src/main/java/foundation/e/drive/operations/UploadChunkedFileOperation.java new file mode 100644 index 00000000..db2db2f2 --- /dev/null +++ b/app/src/main/java/foundation/e/drive/operations/UploadChunkedFileOperation.java @@ -0,0 +1,192 @@ +package foundation.e.drive.operations; + +import static com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode.ETAG_CHANGED; +import static com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode.FILE_NOT_FOUND; + +import android.content.Context; +import android.util.Log; + +import com.owncloud.android.lib.common.OwnCloudClient; +import com.owncloud.android.lib.common.UserInfo; +import com.owncloud.android.lib.common.operations.RemoteOperation; +import com.owncloud.android.lib.common.operations.RemoteOperationResult; +import com.owncloud.android.lib.resources.files.CheckEtagRemoteOperation; +import com.owncloud.android.lib.resources.files.ChunkedFileUploadRemoteOperation; +import com.owncloud.android.lib.resources.files.CreateFolderRemoteOperation; +import com.owncloud.android.lib.resources.files.FileUtils; +import com.owncloud.android.lib.resources.files.MoveFileRemoteOperation; +import com.owncloud.android.lib.resources.users.GetRemoteUserInfoOperation; + +import java.io.File; + +import foundation.e.drive.database.DbHelper; +import foundation.e.drive.models.SyncedFileState; +import foundation.e.drive.utils.CommonUtils; + +public class UploadChunkedFileOperation extends RemoteOperation { + private static final String TAG = UploadChunkedFileOperation.class.getSimpleName(); + private final SyncedFileState syncedFileState; + private final Context context; + + public UploadChunkedFileOperation(SyncedFileState syncedFileState, Context context){ + super(); + this.syncedFileState = syncedFileState; + this.context = context; + } + + @Override + protected RemoteOperationResult run(OwnCloudClient client) { + Log.d(TAG, "Start chunk upload for: "+syncedFileState.getLocalPath()); + final File file = new File(syncedFileState.getLocalPath()); + final long fileSize = new File(syncedFileState.getLocalPath()).length(); + if (fileSize == 0L) { + Log.w(TAG, "Upload aborted: "+syncedFileState.getLocalPath()+" doesn't exist"); + return new RemoteOperationResult(FILE_NOT_FOUND); + } + + final RemoteOperationResult.ResultCode quotaCheckResultCode = checkQuota(fileSize, client); + if(!quotaCheckResultCode.equals(RemoteOperationResult.ResultCode.OK)){ + return new RemoteOperationResult(quotaCheckResultCode); + } + Log.d(TAG, "Quota ok for chunked upload"); + + final String tempDirRemotePath = "test-chunked-upload-"+syncedFileState.getName(); + final RemoteOperationResult.ResultCode mkcolTempDirResultCode = createRemoteFolder(tempDirRemotePath, client); + if(!quotaCheckResultCode.equals(RemoteOperationResult.ResultCode.OK)){ + return new RemoteOperationResult(mkcolTempDirResultCode); + } + + Log.d(TAG, "Temp remote folder created"); + final RemoteOperationResult.ResultCode uploadResult = uploadChunks(tempDirRemotePath, CommonUtils.getMimeType(file), client); + if(!quotaCheckResultCode.equals(RemoteOperationResult.ResultCode.OK)){ + //@TODO check different situation + return new RemoteOperationResult(uploadResult); + } + + Log.d(TAG, "Chunks uploaded"); + final String finalDirRemotePath = syncedFileState.getRemotePath().substring(0, syncedFileState.getRemotePath().lastIndexOf(FileUtils.PATH_SEPARATOR) + 1); + final RemoteOperationResult.ResultCode mkcolTargetDirResultCode = createRemoteFolder(finalDirRemotePath, client); + if(!quotaCheckResultCode.equals(RemoteOperationResult.ResultCode.OK)){ + return new RemoteOperationResult(mkcolTargetDirResultCode); + } + Log.d(TAG, "Target dir exists"); + + final RemoteOperationResult.ResultCode assembleFileResultCode= assembleRemoteFile(tempDirRemotePath, syncedFileState.getRemotePath(), client); + if(!assembleFileResultCode.equals(RemoteOperationResult.ResultCode.OK)){ + return new RemoteOperationResult(assembleFileResultCode); + } + Log.d(TAG, "File assembled"); + final String eTag = getEtag(syncedFileState.getRemotePath(), client); + if(eTag.isEmpty()){ + //@TODO: invalid eTag + } + Log.d(TAG, "Etag obtained: "+eTag); + syncedFileState.setLastETAG(eTag); + DbHelper.manageSyncedFileStateDB(syncedFileState, "UPDATE", context); + + + return new RemoteOperationResult(RemoteOperationResult.ResultCode.OK); + } + + + /** + * Check if there is enough quota on ecloud for the file to upload + * @param client + * @return OK || UNKNOWN_ERROR || QUOTA_EXCEEDED + */ + private RemoteOperationResult.ResultCode checkQuota(long fileSize, OwnCloudClient client) { + final GetRemoteUserInfoOperation getRemoteUserInfoOperation = new GetRemoteUserInfoOperation(); + final RemoteOperationResult ocsResult = executeOperation(getRemoteUserInfoOperation, client); + + if (ocsResult.isSuccess() && ocsResult.getData() != null) { + final UserInfo userInfo = (UserInfo) ocsResult.getData().get(0); + final long availableQuota = userInfo.getQuota().getFree(); + if (availableQuota < fileSize ) { + Log.w(TAG, "quota exceeded!"); + return RemoteOperationResult.ResultCode.QUOTA_EXCEEDED; + } + } else { + Log.w(TAG, "getRemoteUserInfoOperation failed: "+ocsResult.getHttpCode() ); + } + return ocsResult.getCode(); + } + + + /** + * Create a remote folder (can be final folder or temporary folder) + * @param path remote path of the folder + * @param client + * @return + */ + private RemoteOperationResult.ResultCode createRemoteFolder(String path, OwnCloudClient client) { + final CreateFolderRemoteOperation createFolderOperation = new CreateFolderRemoteOperation(path, true); + final RemoteOperationResult createFolderResult = executeOperation(createFolderOperation, client); + + if (!createFolderResult.isSuccess() && createFolderResult.getCode() != RemoteOperationResult.ResultCode.FOLDER_ALREADY_EXISTS) { + return createFolderResult.getCode(); + } + + return RemoteOperationResult.ResultCode.OK; + } + + /** + * Perform upload of file chunk by chunk + * @param client + * @return + */ + private RemoteOperationResult.ResultCode uploadChunks(String tempDirRemotePath, String mimeType, OwnCloudClient client) { + final ChunkedFileUploadRemoteOperation uploadsOperation = new ChunkedFileUploadRemoteOperation(context, "", tempDirRemotePath, mimeType, syncedFileState.getLastETAG(), syncedFileState.getLocalLastModified()+"" ); + final RemoteOperationResult uploadsResult = executeOperation(uploadsOperation, client); + if(!uploadsResult.isSuccess()){ + Log.w(TAG, "upload is not successfull"); + } + //@TODO handle lot of failure case + return uploadsResult.getCode(); + } + + /** + * Assemble the remote chunks + * @param tempDirPath + * @param targetPath + * @param client + * @return + */ + private RemoteOperationResult.ResultCode assembleRemoteFile(String tempDirPath, String targetPath, OwnCloudClient client) { + final MoveFileRemoteOperation moveFileRemoteOperation = new MoveFileRemoteOperation(tempDirPath+"/.files", targetPath, true); + final RemoteOperationResult moveFileResult = executeOperation(moveFileRemoteOperation, client); + + if(!moveFileResult.isSuccess()){ + Log.e(TAG, "Assemble remote chunks failed"); + } + //@TODO handle lot of failure case + return RemoteOperationResult.ResultCode.OK; + } + + private String getEtag(String filepath, OwnCloudClient client) { + final CheckEtagRemoteOperation checkEtagOperation = new CheckEtagRemoteOperation(filepath, ""); + final RemoteOperationResult checkEtagResult = executeOperation(checkEtagOperation, client); + + if (checkEtagResult.getCode().equals(ETAG_CHANGED) && checkEtagResult.getData() != null) { + return (String) checkEtagResult.getData().get(0); + } + + return ""; + } + + + /** + * Method to catch SSL_ERROR or timeout socket connection, etc. + * @param operation + * @param client + * @return + */ + private RemoteOperationResult executeOperation(RemoteOperation operation, OwnCloudClient client) { + try { + return operation.execute(client); + }catch (Exception e){ + Log.e(TAG, e.toString()); + return new RemoteOperationResult(RemoteOperationResult.ResultCode.UNKNOWN_ERROR); + } + } + +} diff --git a/app/src/main/java/foundation/e/drive/operations/UploadFileOperation.java b/app/src/main/java/foundation/e/drive/operations/UploadFileOperation.java index 5b4c24ae..9c4fcc11 100644 --- a/app/src/main/java/foundation/e/drive/operations/UploadFileOperation.java +++ b/app/src/main/java/foundation/e/drive/operations/UploadFileOperation.java @@ -180,7 +180,7 @@ public class UploadFileOperation extends RemoteOperation { if (ocsResult.isSuccess() && ocsResult.getData() != null) { UserInfo userInfo = (UserInfo) ocsResult.getData().get(0); this.availableQuota = userInfo.getQuota().getFree(); - if (((UserInfo) ocsResult.getData().get(0)).getQuota().getFree() < fileSize ) { + if (availableQuota < fileSize ) { Log.w(TAG, "quota exceeded!"); return new RemoteOperationResult(ResultCode.QUOTA_EXCEEDED); } else { -- GitLab From faf36f76129431009b3f30021bcd4705c7c6a36d Mon Sep 17 00:00:00 2001 From: vincent Bourgmayer Date: Fri, 6 May 2022 11:18:42 +0200 Subject: [PATCH 02/11] SynchronizationService run ChunkedUpload for file heavier than 10 MB --- .../e/drive/services/SynchronizationService.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/foundation/e/drive/services/SynchronizationService.java b/app/src/main/java/foundation/e/drive/services/SynchronizationService.java index 72cee50c..0a52f2aa 100644 --- a/app/src/main/java/foundation/e/drive/services/SynchronizationService.java +++ b/app/src/main/java/foundation/e/drive/services/SynchronizationService.java @@ -30,7 +30,9 @@ import com.owncloud.android.lib.common.OwnCloudClient; import com.owncloud.android.lib.common.operations.OnRemoteOperationListener; import com.owncloud.android.lib.common.operations.RemoteOperation; import com.owncloud.android.lib.common.operations.RemoteOperationResult; +import com.owncloud.android.lib.resources.files.ChunkedFileUploadRemoteOperation; +import java.io.File; import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.Collection; @@ -44,6 +46,7 @@ import foundation.e.drive.models.SyncRequest; import foundation.e.drive.models.SyncedFileState; import foundation.e.drive.operations.DownloadFileOperation; import foundation.e.drive.operations.RemoveFileOperation; +import foundation.e.drive.operations.UploadChunkedFileOperation; import foundation.e.drive.operations.UploadFileOperation; import foundation.e.drive.utils.AppConstants; import foundation.e.drive.utils.CommonUtils; @@ -180,6 +183,8 @@ public class SynchronizationService extends Service implements OnRemoteOperation } } else if (callerOperation instanceof DownloadFileOperation) { Log.e(TAG, " Download: Unknown_error : failed"); + } else if(callerOperation instanceof UploadChunkedFileOperation) { + Log.e(TAG, "Chunked upload failed for unknown reason"); } break; case FORBIDDEN: @@ -215,7 +220,12 @@ public class SynchronizationService extends Service implements OnRemoteOperation switch (request.getOperationType()){ case UPLOAD: final SyncedFileState sfs = request.getSyncedFileState(); - operation = new UploadFileOperation(sfs, getApplicationContext()); + final File file = new File(sfs.getLocalPath()); + if (file.length() > 10240000) { //10 MB + operation = new UploadChunkedFileOperation(sfs, getApplicationContext()); + } else { + operation = new UploadFileOperation(sfs, getApplicationContext()); + } break; case DOWNLOAD: final DownloadRequest downloadRequest = (DownloadRequest) request; -- GitLab From bd4f5370c74dfd565405a6fe7177b09bf296f4e6 Mon Sep 17 00:00:00 2001 From: vincent Bourgmayer Date: Fri, 6 May 2022 12:14:11 +0200 Subject: [PATCH 03/11] fix copy paste error --- .../drive/operations/UploadChunkedFileOperation.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/foundation/e/drive/operations/UploadChunkedFileOperation.java b/app/src/main/java/foundation/e/drive/operations/UploadChunkedFileOperation.java index db2db2f2..e837e4ff 100644 --- a/app/src/main/java/foundation/e/drive/operations/UploadChunkedFileOperation.java +++ b/app/src/main/java/foundation/e/drive/operations/UploadChunkedFileOperation.java @@ -52,21 +52,21 @@ public class UploadChunkedFileOperation extends RemoteOperation { final String tempDirRemotePath = "test-chunked-upload-"+syncedFileState.getName(); final RemoteOperationResult.ResultCode mkcolTempDirResultCode = createRemoteFolder(tempDirRemotePath, client); - if(!quotaCheckResultCode.equals(RemoteOperationResult.ResultCode.OK)){ + if(!mkcolTempDirResultCode.equals(RemoteOperationResult.ResultCode.OK)){ return new RemoteOperationResult(mkcolTempDirResultCode); } Log.d(TAG, "Temp remote folder created"); - final RemoteOperationResult.ResultCode uploadResult = uploadChunks(tempDirRemotePath, CommonUtils.getMimeType(file), client); - if(!quotaCheckResultCode.equals(RemoteOperationResult.ResultCode.OK)){ + final RemoteOperationResult.ResultCode uploadResultCode = uploadChunks(tempDirRemotePath, CommonUtils.getMimeType(file), client); + if(!uploadResultCode.equals(RemoteOperationResult.ResultCode.OK)){ //@TODO check different situation - return new RemoteOperationResult(uploadResult); + return new RemoteOperationResult(uploadResultCode); } Log.d(TAG, "Chunks uploaded"); final String finalDirRemotePath = syncedFileState.getRemotePath().substring(0, syncedFileState.getRemotePath().lastIndexOf(FileUtils.PATH_SEPARATOR) + 1); final RemoteOperationResult.ResultCode mkcolTargetDirResultCode = createRemoteFolder(finalDirRemotePath, client); - if(!quotaCheckResultCode.equals(RemoteOperationResult.ResultCode.OK)){ + if(!mkcolTargetDirResultCode.equals(RemoteOperationResult.ResultCode.OK)){ return new RemoteOperationResult(mkcolTargetDirResultCode); } Log.d(TAG, "Target dir exists"); @@ -135,7 +135,7 @@ public class UploadChunkedFileOperation extends RemoteOperation { * @return */ private RemoteOperationResult.ResultCode uploadChunks(String tempDirRemotePath, String mimeType, OwnCloudClient client) { - final ChunkedFileUploadRemoteOperation uploadsOperation = new ChunkedFileUploadRemoteOperation(context, "", tempDirRemotePath, mimeType, syncedFileState.getLastETAG(), syncedFileState.getLocalLastModified()+"" ); + final ChunkedFileUploadRemoteOperation uploadsOperation = new ChunkedFileUploadRemoteOperation(context, syncedFileState.getLocalPath(), tempDirRemotePath, mimeType, syncedFileState.getLastETAG(), syncedFileState.getLocalLastModified()+"" ); final RemoteOperationResult uploadsResult = executeOperation(uploadsOperation, client); if(!uploadsResult.isSuccess()){ Log.w(TAG, "upload is not successfull"); -- GitLab From 88ee88a578c4ecc044d33d6a338e6b28681d7d03 Mon Sep 17 00:00:00 2001 From: Abhishek Aggarwal Date: Mon, 9 May 2022 06:48:41 +0000 Subject: [PATCH 04/11] Apply 1 suggestion(s) to 1 file(s) --- .../e/drive/operations/UploadChunkedFileOperation.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/foundation/e/drive/operations/UploadChunkedFileOperation.java b/app/src/main/java/foundation/e/drive/operations/UploadChunkedFileOperation.java index e837e4ff..1a121b59 100644 --- a/app/src/main/java/foundation/e/drive/operations/UploadChunkedFileOperation.java +++ b/app/src/main/java/foundation/e/drive/operations/UploadChunkedFileOperation.java @@ -36,7 +36,7 @@ public class UploadChunkedFileOperation extends RemoteOperation { @Override protected RemoteOperationResult run(OwnCloudClient client) { - Log.d(TAG, "Start chunk upload for: "+syncedFileState.getLocalPath()); + Log.d(TAG, "Start chunk upload for: " + syncedFileState.getLocalPath()); final File file = new File(syncedFileState.getLocalPath()); final long fileSize = new File(syncedFileState.getLocalPath()).length(); if (fileSize == 0L) { -- GitLab From bf79f55c8422d9237473015481c8d84daeb5baee Mon Sep 17 00:00:00 2001 From: Abhishek Aggarwal Date: Mon, 9 May 2022 06:48:48 +0000 Subject: [PATCH 05/11] Apply 1 suggestion(s) to 1 file(s) --- .../e/drive/operations/UploadChunkedFileOperation.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/foundation/e/drive/operations/UploadChunkedFileOperation.java b/app/src/main/java/foundation/e/drive/operations/UploadChunkedFileOperation.java index 1a121b59..f0d06b0b 100644 --- a/app/src/main/java/foundation/e/drive/operations/UploadChunkedFileOperation.java +++ b/app/src/main/java/foundation/e/drive/operations/UploadChunkedFileOperation.java @@ -40,7 +40,7 @@ public class UploadChunkedFileOperation extends RemoteOperation { final File file = new File(syncedFileState.getLocalPath()); final long fileSize = new File(syncedFileState.getLocalPath()).length(); if (fileSize == 0L) { - Log.w(TAG, "Upload aborted: "+syncedFileState.getLocalPath()+" doesn't exist"); + Log.w(TAG, "Upload aborted: " + syncedFileState.getLocalPath() + " doesn't exist"); return new RemoteOperationResult(FILE_NOT_FOUND); } -- GitLab From dc6a8547002c4f361a1d4423133e168a71124626 Mon Sep 17 00:00:00 2001 From: Abhishek Aggarwal Date: Mon, 9 May 2022 06:48:55 +0000 Subject: [PATCH 06/11] Apply 1 suggestion(s) to 1 file(s) --- .../e/drive/operations/UploadChunkedFileOperation.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/foundation/e/drive/operations/UploadChunkedFileOperation.java b/app/src/main/java/foundation/e/drive/operations/UploadChunkedFileOperation.java index f0d06b0b..31739b28 100644 --- a/app/src/main/java/foundation/e/drive/operations/UploadChunkedFileOperation.java +++ b/app/src/main/java/foundation/e/drive/operations/UploadChunkedFileOperation.java @@ -45,7 +45,7 @@ public class UploadChunkedFileOperation extends RemoteOperation { } final RemoteOperationResult.ResultCode quotaCheckResultCode = checkQuota(fileSize, client); - if(!quotaCheckResultCode.equals(RemoteOperationResult.ResultCode.OK)){ + if(!quotaCheckResultCode.equals(RemoteOperationResult.ResultCode.OK)) { return new RemoteOperationResult(quotaCheckResultCode); } Log.d(TAG, "Quota ok for chunked upload"); -- GitLab From c3adbc008b0d55e45cdeb7297524ba4938313b39 Mon Sep 17 00:00:00 2001 From: Abhishek Aggarwal Date: Mon, 9 May 2022 06:49:02 +0000 Subject: [PATCH 07/11] Apply 1 suggestion(s) to 1 file(s) --- .../e/drive/operations/UploadChunkedFileOperation.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/foundation/e/drive/operations/UploadChunkedFileOperation.java b/app/src/main/java/foundation/e/drive/operations/UploadChunkedFileOperation.java index 31739b28..d248696d 100644 --- a/app/src/main/java/foundation/e/drive/operations/UploadChunkedFileOperation.java +++ b/app/src/main/java/foundation/e/drive/operations/UploadChunkedFileOperation.java @@ -50,7 +50,7 @@ public class UploadChunkedFileOperation extends RemoteOperation { } Log.d(TAG, "Quota ok for chunked upload"); - final String tempDirRemotePath = "test-chunked-upload-"+syncedFileState.getName(); + final String tempDirRemotePath = "test-chunked-upload-" + syncedFileState.getName(); final RemoteOperationResult.ResultCode mkcolTempDirResultCode = createRemoteFolder(tempDirRemotePath, client); if(!mkcolTempDirResultCode.equals(RemoteOperationResult.ResultCode.OK)){ return new RemoteOperationResult(mkcolTempDirResultCode); -- GitLab From 9e961d984093a61506ab34a11ec3488f8b48cfe8 Mon Sep 17 00:00:00 2001 From: Abhishek Aggarwal Date: Mon, 9 May 2022 06:49:54 +0000 Subject: [PATCH 08/11] Apply 1 suggestion(s) to 1 file(s) --- .../e/drive/operations/UploadChunkedFileOperation.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/foundation/e/drive/operations/UploadChunkedFileOperation.java b/app/src/main/java/foundation/e/drive/operations/UploadChunkedFileOperation.java index d248696d..28786a15 100644 --- a/app/src/main/java/foundation/e/drive/operations/UploadChunkedFileOperation.java +++ b/app/src/main/java/foundation/e/drive/operations/UploadChunkedFileOperation.java @@ -72,7 +72,7 @@ public class UploadChunkedFileOperation extends RemoteOperation { Log.d(TAG, "Target dir exists"); final RemoteOperationResult.ResultCode assembleFileResultCode= assembleRemoteFile(tempDirRemotePath, syncedFileState.getRemotePath(), client); - if(!assembleFileResultCode.equals(RemoteOperationResult.ResultCode.OK)){ + if(!assembleFileResultCode.equals(RemoteOperationResult.ResultCode.OK)) { return new RemoteOperationResult(assembleFileResultCode); } Log.d(TAG, "File assembled"); -- GitLab From 7c6a332f56159f82a61e8e8ad638afabd24d52ea Mon Sep 17 00:00:00 2001 From: Abhishek Aggarwal Date: Mon, 9 May 2022 06:50:16 +0000 Subject: [PATCH 09/11] Apply 1 suggestion(s) to 1 file(s) --- .../e/drive/operations/UploadChunkedFileOperation.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/foundation/e/drive/operations/UploadChunkedFileOperation.java b/app/src/main/java/foundation/e/drive/operations/UploadChunkedFileOperation.java index 28786a15..69ad2ae6 100644 --- a/app/src/main/java/foundation/e/drive/operations/UploadChunkedFileOperation.java +++ b/app/src/main/java/foundation/e/drive/operations/UploadChunkedFileOperation.java @@ -77,7 +77,7 @@ public class UploadChunkedFileOperation extends RemoteOperation { } Log.d(TAG, "File assembled"); final String eTag = getEtag(syncedFileState.getRemotePath(), client); - if(eTag.isEmpty()){ + if(eTag.isEmpty()) { //@TODO: invalid eTag } Log.d(TAG, "Etag obtained: "+eTag); -- GitLab From b63f6561db4b3a771b6f021cf0375eb1d412c528 Mon Sep 17 00:00:00 2001 From: Abhishek Aggarwal Date: Mon, 9 May 2022 06:50:23 +0000 Subject: [PATCH 10/11] Apply 1 suggestion(s) to 1 file(s) --- .../e/drive/operations/UploadChunkedFileOperation.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/foundation/e/drive/operations/UploadChunkedFileOperation.java b/app/src/main/java/foundation/e/drive/operations/UploadChunkedFileOperation.java index 69ad2ae6..2e96b2cd 100644 --- a/app/src/main/java/foundation/e/drive/operations/UploadChunkedFileOperation.java +++ b/app/src/main/java/foundation/e/drive/operations/UploadChunkedFileOperation.java @@ -106,7 +106,7 @@ public class UploadChunkedFileOperation extends RemoteOperation { return RemoteOperationResult.ResultCode.QUOTA_EXCEEDED; } } else { - Log.w(TAG, "getRemoteUserInfoOperation failed: "+ocsResult.getHttpCode() ); + Log.w(TAG, "getRemoteUserInfoOperation failed: " + ocsResult.getHttpCode()); } return ocsResult.getCode(); } -- GitLab From fd6f88deaea2b264dc503b0b267f3330713a144d Mon Sep 17 00:00:00 2001 From: Abhishek Aggarwal Date: Mon, 9 May 2022 06:50:30 +0000 Subject: [PATCH 11/11] Apply 1 suggestion(s) to 1 file(s) --- .../e/drive/operations/UploadChunkedFileOperation.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/foundation/e/drive/operations/UploadChunkedFileOperation.java b/app/src/main/java/foundation/e/drive/operations/UploadChunkedFileOperation.java index 2e96b2cd..dee5655e 100644 --- a/app/src/main/java/foundation/e/drive/operations/UploadChunkedFileOperation.java +++ b/app/src/main/java/foundation/e/drive/operations/UploadChunkedFileOperation.java @@ -155,7 +155,7 @@ public class UploadChunkedFileOperation extends RemoteOperation { final MoveFileRemoteOperation moveFileRemoteOperation = new MoveFileRemoteOperation(tempDirPath+"/.files", targetPath, true); final RemoteOperationResult moveFileResult = executeOperation(moveFileRemoteOperation, client); - if(!moveFileResult.isSuccess()){ + if(!moveFileResult.isSuccess()) { Log.e(TAG, "Assemble remote chunks failed"); } //@TODO handle lot of failure case -- GitLab