Add case for when trying to download a file that is no longer available on the server
authorjabarros <jabarros@solidgear.es>
Fri, 11 Jul 2014 11:10:07 +0000 (13:10 +0200)
committerDavid A. Velasco <dvelasco@solidgear.es>
Fri, 25 Jul 2014 07:11:21 +0000 (09:11 +0200)
res/values/strings.xml
src/com/owncloud/android/utils/ErrorMessageAdapter.java

index e66c2d1..a8da038 100644 (file)
        <string name="unshare_link_forbidden_permissions">to unshare this file</string>
        <string name="forbidden_permissions_create">to create the file</string>
        <string name="uploader_upload_forbidden_permissions">to upload in this folder</string>
+       <string name="downloader_download_file_not_found">The file is no longer available on the server</string>
 
 </resources>
index 25a0dfe..ebdadc1 100644 (file)
@@ -89,8 +89,13 @@ public class ErrorMessageAdapter {
                         new File(((DownloadFileOperation) operation).getSavePath()).getName());
                 
             } else {
-                message = String.format(res.getString(R.string.downloader_download_failed_content), 
-                        new File(((DownloadFileOperation) operation).getSavePath()).getName());
+                if (result.getCode() == ResultCode.FILE_NOT_FOUND) {
+                    message = res.getString(R.string.downloader_download_file_not_found);
+
+                } else {
+                    message = String.format(res.getString(R.string.downloader_download_failed_content), new File(
+                            ((DownloadFileOperation) operation).getSavePath()).getName());
+                }
             }
             
         } else if (operation instanceof RemoveFileOperation) {