nextcloud / android

📱 Nextcloud Android app
https://play.google.com/store/apps/details?id=com.nextcloud.client
GNU General Public License v2.0
4.32k stars 1.78k forks source link

[3.13.0 RC4] file download fails for some but not all files #6678

Closed j-ed closed 4 years ago

j-ed commented 4 years ago

Actual behavior

The directory and file structure on my server exists for a couple of years now. I was always able to download all kind of files without a problem. Two weeks ago I changed the Nextcloud storage path from internal storage to a sd card (/storage/xxxx-xxxx/Android/media/com.nextcloud.client) to free some space on my mobile phone. All data was moved to that directory and the app seems to work as expected. Yesterday I realized that I wasn't able to access/download files in a specific folder, which definitely worked before. If I select a pdf file in the folder is seems to be downloaded to my mobile device although an error message is being displayed and but the pdf viewer isn't opened automatically. Error message:

Herunterladen fehlgeschlagen
Konnte user@nextcloud.domain.com%3A443null nicht herunterladen

I checked the directory and file structure on the sd card which looks like this:

STORAGE PATH: /storage/xxxx-xxxx/Android/media/com.nextcloud.client

- user@nextcloud.domain.com%3A443
  - folder-1

- tmp
  - user@nextcloud.domain.com%3A443
    - folder-1
      - folder-2
        * downloaded-file.pdf

The pdf file in the tmp folder is the one I selected to download and I'm able to open the file using a normal file manager. It looks to me as if a problem appeared moving the file to the correct destination directory. To make sure that this isn't a general problem I tested downloading other file from a different folder, which worked fine. All of them where stored in the correct destination directory. Next I checked the log file and found the following information:

2020-08-08T09:31:47.563+0200;I;ServerNameIndicator;SNI done, hostname: nextcloud.domain.com
2020-08-08T09:31:47.747+0200;I;ReadFileVersionsRemoteOperation;Synchronized file with id 1791711: Operation finished with HTTP status code 207 (success)
2020-08-08T09:31:48.176+0200;I;ReadFileVersionsRemoteOperation;Synchronized file with id 1791711: Operation finished with HTTP status code 207 (success)
2020-08-08T09:31:48.377+0200;I;DownloadFileRemoteOperation;Download of /folder-1/folder-2/downloaded-file.pdf to /storage/10F7-E90F/Android/media/com.nextcloud.client/nextcloud/tmp/user@nextcloud.domain.com%3A443/folder-1/folder-2/downloaded-file.pdf: Operation finished with HTTP status code 200 (success)
2020-08-08T09:31:48.378+0200;E;DownloadFileOperation;Unable to create parent folder /storage/emulated/0/Android/media/com.nextcloud.client/nextcloud
2020-08-08T09:31:48.378+0200;I;DownloadFileOperation;Download of /folder-1/folder-2/downloaded-file.pdf to /storage/emulated/0/Android/media/com.nextcloud.client/nextcloud/user@nextcloud.domain.com%3A443null: Error while moving file to final directory
2020-08-08T09:31:48.400+0200;D;FileDownloader;Stopping after command with id 1

These are the conclusions from the log:

  1. The selected file is correctly downloaded and stored in the tmp folder on the sd card.
  2. It seems that the app tries to create a parent folder on the internal storage which fails which causes the error. I assume /storage/emulated/0 is the internal storage, right? -> A folder with the given name /Android/media/com.nextcloud.client/nextcloud already exists and therefore couldn't be created again?!

Expected behavior

The file should be downloaded and displayed as usual.

Environment data

Android version: 8.0.0 Device model: Samsung Galaxy S7 Stock or customized system: stock Nextcloud app version: 3.13.0 RC3 Nextcloud server version: 19.0.1 Reverse proxy: no

AndyScherzinger commented 4 years ago

very likely related to #6589

@j-ed can you locally remove (via the app) the downloaded files, do a pull-to refresh on the folder and try again (also using RC4). Afaik @tobiasKaminsky fixed this but in case you refreshed the folder before then its meta data is corrupted in the client side and needs to be reloaded/refreshed before files in the particular folder will properly download/work again

j-ed commented 4 years ago

@AndyScherzinger I tried the way you described to fix the problem. It worked for two files which had local copies on my mobile, but with all other files in that folder it didn't work. Next I've deleted the whole folder on the sd card but without getting the problem fixed after refreshing the folder view. Then I deleted the whole content of the folder on the server too, refreshed the folder view to get an empty folder displayed, copied back all files on the server from a backup, refreshed the folder view on my mobile again and after that all files seem to be accessible/downloadable again.

AndyScherzinger commented 4 years ago

@tobiasKaminsky it seems @j-ed has (more or less, can't say for sure) the exact same behavior as reported by @Wikinaut before via #6589

Wikinaut commented 4 years ago

@j-ed I confirm, I have the very same problem.

tobiasKaminsky commented 4 years ago

Then let us combine it with #6589