Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 874f30f0 authored by Vincent Bourgmayer's avatar Vincent Bourgmayer Committed by Vincent Bourgmayer
Browse files

Fix remote folder creation when missing for file upload

parent 07e97479
Loading
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -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 );