diff --git a/owncloud-android-library b/owncloud-android-library
index b0ac6b3fc9..6ff6f75ee2 160000
--- a/owncloud-android-library
+++ b/owncloud-android-library
@@ -1 +1 @@
-Subproject commit b0ac6b3fc94aa52a43927fae7b548e9123acf1bb
+Subproject commit 6ff6f75ee20e1b28f84a3ca5213dccb5907a2bed
diff --git a/res/values/strings.xml b/res/values/strings.xml
index a2fafdb41c..adb0314f1a 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -127,6 +127,7 @@
Credentials error
Folder error
File error
+ Local file not found
Permission error
Upload failed
Waiting for
@@ -440,5 +441,6 @@
Some files could not be deleted.
Additional permissions required to upload & download files.
+ The file was not found locally
diff --git a/src/com/owncloud/android/db/UploadResult.java b/src/com/owncloud/android/db/UploadResult.java
index 9d69a8d9a8..1ae94b48e2 100644
--- a/src/com/owncloud/android/db/UploadResult.java
+++ b/src/com/owncloud/android/db/UploadResult.java
@@ -33,7 +33,8 @@ public enum UploadResult {
FILE_ERROR(5),
PRIVILEDGES_ERROR(6),
CANCELLED(7),
- UNKNOWN(8);
+ FILE_NOT_FOUND(8),
+ UNKNOWN(9);
private final int value;
@@ -63,6 +64,8 @@ public enum UploadResult {
case 7:
return CANCELLED;
case 8:
+ return FILE_NOT_FOUND;
+ case 9:
return UNKNOWN;
}
return null;
@@ -82,6 +85,8 @@ public enum UploadResult {
return CREDENTIAL_ERROR;
case FILE_NOT_FOUND:
return FOLDER_ERROR;
+ case LOCAL_FILE_NOT_FOUND:
+ return FILE_NOT_FOUND;
case CONFLICT:
return CONFLICT_ERROR;
case LOCAL_STORAGE_NOT_COPIED:
diff --git a/src/com/owncloud/android/operations/UploadFileOperation.java b/src/com/owncloud/android/operations/UploadFileOperation.java
index 1a9828255c..33bc0febd3 100644
--- a/src/com/owncloud/android/operations/UploadFileOperation.java
+++ b/src/com/owncloud/android/operations/UploadFileOperation.java
@@ -332,6 +332,13 @@ public class UploadFileOperation extends SyncOperation {
mUploadStarted.set(true);
RemoteOperationResult result = null;
File temporalFile = null, originalFile = new File(mOriginalStoragePath), expectedFile = null;
+
+ // check if the file continues existing before schedule the operation
+ if (!originalFile.exists()) {
+ Log_OC.d(TAG, mOriginalStoragePath.toString() + " not exists anymore");
+ return new RemoteOperationResult(ResultCode.LOCAL_FILE_NOT_FOUND);
+ }
+
try {
/// check the existence of the parent folder for the file to upload
String remoteParentPath = new File(getRemotePath()).getParent();
diff --git a/src/com/owncloud/android/ui/adapter/ExpandableUploadListAdapter.java b/src/com/owncloud/android/ui/adapter/ExpandableUploadListAdapter.java
index 301a38b700..72ec3856a2 100755
--- a/src/com/owncloud/android/ui/adapter/ExpandableUploadListAdapter.java
+++ b/src/com/owncloud/android/ui/adapter/ExpandableUploadListAdapter.java
@@ -34,6 +34,7 @@ import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;
+import android.widget.Toast;
import com.owncloud.android.R;
import com.owncloud.android.authentication.AuthenticatorActivity;
@@ -304,6 +305,10 @@ public class ExpandableUploadListAdapter extends BaseExpandableListAdapter imple
status = mParentActivity.getString(
R.string.uploads_view_upload_status_failed_folder_error);
break;
+ case FILE_NOT_FOUND:
+ status = mParentActivity.getString(
+ R.string.uploads_view_upload_status_failed_localfile_error);
+ break;
case FILE_ERROR:
status = mParentActivity.getString(
R.string.uploads_view_upload_status_failed_file_error);
@@ -411,7 +416,13 @@ public class ExpandableUploadListAdapter extends BaseExpandableListAdapter imple
view.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
- mParentActivity.getFileOperationsHelper().retryUpload(upload);
+ File file = new File(upload.getLocalPath());
+ if (file.exists())
+ mParentActivity.getFileOperationsHelper().retryUpload(upload);
+ else {
+ final String message = String.format(mParentActivity.getString(R.string.local_file_not_found_toast));
+ Toast.makeText(mParentActivity, message, Toast.LENGTH_SHORT).show();
+ }
}
});
}