Image Files become 0Kb after trying to access them

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

longer
example
here

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version 27.1 AIO
Operating system and version Debian 12 / Docker
Apache or nginx version AiO edition behind NginX reverse proxy
PHP version 8.1.23

The issue you are facing:
All file storage is via several external storage connectors - SFTP to TrueNas (Approx 50Tb in total). Most users are mounted Readonly.
All external storage showing green ticks and using Global Credentials which are OK.

When we try to access an image file (.jpg) for download we are presented with the following error in the browser:
This is the WebDAV interface. It can only be accessed by WebDAV clients such as the Nextcloud desktop sync client.

If we try to access the file for preview in the browser, the preview just spins. Returning to that folder then shows the image files as 0Kb and cannot be accessed or downloaded via Nextcloud. This is persistent after a nextcloud reboot.
The files are however still intact on the backend storage.
Other file types seem OK. PDF’s will open in preview.

In the file crumbtrail we are often presented with “You do not have permission to upload or create files here.”

Is this the first time you’ve seen this error? (Y/N): Y

The output of your Nextcloud log in Admin > Logging:

fopen(sftpread://mnt/tank2/archive/GTP_Headshot-2.jpg): Failed to open stream: "OCA\Files_External\Lib\Storage\SFTPReadStream::stream_open" call failed at /var/www/html/apps/files_external/lib/Lib/Storage/SFTP.php#381
Error	core	Can't get app storage, app files_external, user not logged in
Error	core	Can't get app storage, app files_external, user not logged in
Error	core	Can't get app storage, app files_external, user not logged in
Error	core	Can't get app storage, app files_external, user not logged in

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

PASTE HERE

The output of your Apache/nginx/system log in /var/log/____:

PASTE HERE

PASTE HERE


Output errors in nextcloud.log in /var/www/ or as admin user in top right menu, filtering for errors. Use a pastebin service if necessary.

PASTE HERE

Is there a specific reason why you are using SFTP instead of NFS or SMB?

Looks like you are trying to access the file directly via the WebDAV URL ( …/remote.php/dav/files/username/… ). That’s not going to work in a browser. You have to use a WebDAV client in order to connect to the WebDAV interface.

fopen(sftpread://mnt/tank2/archive/GTP_Headshot-2.jpg): Failed to open stream: "OCA\Files_External\Lib\Storage\SFTPReadStream::stream_open" call failed at /var/www/html/apps/files_external/lib/Lib/Storage/SFTP.php#381
Error	core	Can't get app storage, app files_external, user not logged in

The log messages are pretty clear. For some reason the external storage app is not logged in anymore to the external storage. I don’t know why this happens, but I strongly recommend using a better suited protocol like NFS or SMB to connect to your TrueNAS box, unless there is a compelling reason why you can’t do so.