X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/83ad608faadfcfc5a0ceee9d6c460702b3ff3f11..9da433bb7b8e6044bbcd0e07e475f38213f64df4:/src/com/owncloud/android/operations/UploadFileOperation.java diff --git a/src/com/owncloud/android/operations/UploadFileOperation.java b/src/com/owncloud/android/operations/UploadFileOperation.java index 7d51a4ad..cd5f8a13 100644 --- a/src/com/owncloud/android/operations/UploadFileOperation.java +++ b/src/com/owncloud/android/operations/UploadFileOperation.java @@ -1,5 +1,8 @@ -/* ownCloud Android client application - * Copyright (C) 2012-2015 ownCloud Inc. +/** + * ownCloud Android client application + * + * @author David A. Velasco + * Copyright (C) 2015 ownCloud Inc. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2, @@ -56,8 +59,6 @@ import com.owncloud.android.utils.UriUtils; /** * Remote operation performing the upload of a file to an ownCloud server - * - * @author David A. Velasco */ public class UploadFileOperation extends RemoteOperation { @@ -258,7 +259,6 @@ public class UploadFileOperation extends RemoteOperation { (nRead = in.read(data, 0, data.length)) != -1) { out.write(data, 0, nRead); } - out.flush(); } else { @@ -278,6 +278,11 @@ public class UploadFileOperation extends RemoteOperation { } } + if (mCancellationRequested.get()) { + result = new RemoteOperationResult(new OperationCancelledException()); + } + + } catch (Exception e) { result = new RemoteOperationResult(ResultCode.LOCAL_STORAGE_NOT_COPIED); return result; @@ -300,7 +305,7 @@ public class UploadFileOperation extends RemoteOperation { } } } - localCopyPassed = true; + localCopyPassed = (result == null); /// perform the upload if ( mChunked &&