Эх сурвалжийг харах

Try to fix

Signed-off-by: Mario Danic <mario@lovelyhq.com>
Mario Danic 7 жил өмнө
parent
commit
0e0a6ac241

+ 16 - 6
src/main/java/com/owncloud/android/operations/UploadFileOperation.java

@@ -436,7 +436,7 @@ public class UploadFileOperation extends SyncOperation {
             long size = 0;
             long size = 0;
             UploadsStorageManager uploadsStorageManager = new UploadsStorageManager(mContext.getContentResolver(),
             UploadsStorageManager uploadsStorageManager = new UploadsStorageManager(mContext.getContentResolver(),
                     mContext);
                     mContext);
-            if (result == null) {
+            if (result == null || result.isSuccess()) {
                 if ((mFile.getStoragePath().length() == 0 || onSDCard) && !(new File(mFile.getStoragePath()).isDirectory())) {
                 if ((mFile.getStoragePath().length() == 0 || onSDCard) && !(new File(mFile.getStoragePath()).isDirectory())) {
                     size = channel.size();
                     size = channel.size();
 
 
@@ -468,11 +468,21 @@ public class UploadFileOperation extends SyncOperation {
                 /// perform the upload
                 /// perform the upload
                 if (mChunked &&
                 if (mChunked &&
                         (size > ChunkedUploadRemoteFileOperation.CHUNK_SIZE)) {
                         (size > ChunkedUploadRemoteFileOperation.CHUNK_SIZE)) {
-                    mUploadOperation = new ChunkedUploadRemoteFileOperation(mContext, mFile.getStoragePath(),
-                            mFile.getRemotePath(), mFile.getMimetype(), mFile.getEtagInConflict(), timeStamp, size);
+                    if (mFile.getStoragePath().length() == 0) {
+                        mUploadOperation = new ChunkedUploadRemoteFileOperation(mContext, mFile.getStoragePath(),
+                                mFile.getRemotePath(), mFile.getMimetype(), mFile.getEtagInConflict(), timeStamp, size);
+                    } else {
+                        mUploadOperation = new ChunkedUploadRemoteFileOperation(mContext, mFile.getStoragePath(),
+                                mFile.getRemotePath(), mFile.getMimetype(), mFile.getEtagInConflict(), timeStamp);
+                    }
                 } else {
                 } else {
-                    mUploadOperation = new UploadRemoteFileOperation(mFile.getStoragePath(),
-                            mFile.getRemotePath(), mFile.getMimetype(), mFile.getEtagInConflict(), timeStamp, size);
+                    if (mFile.getStoragePath().length() == 0) {
+                        mUploadOperation = new UploadRemoteFileOperation(mFile.getStoragePath(),
+                                mFile.getRemotePath(), mFile.getMimetype(), mFile.getEtagInConflict(), timeStamp, size);
+                    } else {
+                        mUploadOperation = new UploadRemoteFileOperation(mFile.getStoragePath(),
+                                mFile.getRemotePath(), mFile.getMimetype(), mFile.getEtagInConflict(), timeStamp);
+                    }
                 }
                 }
 
 
                 Iterator<OnDatatransferProgressListener> listener = mDataTransferListeners.iterator();
                 Iterator<OnDatatransferProgressListener> listener = mDataTransferListeners.iterator();
@@ -485,7 +495,7 @@ public class UploadFileOperation extends SyncOperation {
                 throw new OperationCancelledException();
                 throw new OperationCancelledException();
             }
             }
 
 
-            if (result == null) {
+            if (result == null || result.isSuccess()) {
                 result = mUploadOperation.execute(client);
                 result = mUploadOperation.execute(client);
 
 
                 /// move local temporal file or original file to its corresponding
                 /// move local temporal file or original file to its corresponding