From 874f30f080e6f5e194af3bb5615152b84ae545f8 Mon Sep 17 00:00:00 2001 From: Vincent Bourgmayer Date: Fri, 25 Mar 2022 06:38:59 +0000 Subject: [PATCH] Fix remote folder creation when missing for file upload --- .../e/drive/operations/UploadFileOperation.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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 d4d685d0..9f95186c 100644 --- a/app/src/main/java/foundation/e/drive/operations/UploadFileOperation.java +++ b/app/src/main/java/foundation/e/drive/operations/UploadFileOperation.java @@ -148,11 +148,11 @@ public class UploadFileOperation extends RemoteOperation implements ComparableOp mustRestart = false; }else{ //Si les répértoires ou mettre le fichier n'existe pas, on les ajoutes. - if( uploadResult.getCode() == ResultCode.FILE_NOT_FOUND ){ - Log.d(TAG, "Catched a File not found result for : "+file.getName()+", create missing remote path then retry"); - String remoteFoldersPath = targetPath.substring( 0, targetPath.lastIndexOf(FileUtils.PATH_SEPARATOR)+1 ); - mResultCode = ResultCode.FILE_NOT_FOUND; - CreateFolderRemoteOperation createFolderOperation = new CreateFolderRemoteOperation( remoteFoldersPath, true ); + if (uploadResult.getCode() == ResultCode.CONFLICT ) { + mResultCode = ResultCode.CONFLICT; + Log.d(TAG, "Catched a conflict result for : "+file.getName()+", create missing remote path then retry"); + final String remoteFolderPath = targetPath.substring(0, targetPath.lastIndexOf(FileUtils.PATH_SEPARATOR)+1 ); + final CreateFolderRemoteOperation createFolderOperation = new CreateFolderRemoteOperation(remoteFolderPath, true ); try{ RemoteOperationResult createFolderResult = createFolderOperation.execute( client ); -- GitLab