Bug description
When a remote Nextcloud user shares a single file (not a folder) via Federated Share (OCM), the recipient's preview system returns HTTP 500 for all preview requests (/core/preview?fileId=...).
The root cause is that NC's preview system runs in the context of the federated share owner (user@remote-server) instead of the local recipient. Since the federated user does not exist as a local user, OC\User\NoUserException is thrown and the preview fails.
This only affects file-level federated shares. Folder-level federated shares work correctly because the files inside have proper path and name values in oc_filecache. File-level shares have path="" and name="" (the storage root represents the file itself), which causes the preview system to use the wrong user context.
Steps to reproduce
- Server A (NC 33): User
user1@remote-server shares a single file (e.g. cleo.jpg) as a Federated Share to recipient@your-server
-
- Recipient accepts the share on Server B (NC 33)
-
- Recipient opens the "Shared with me" view
-
- Browser requests
/core/preview?fileId=<id>&x=32&y=32&mimeFallback=true → HTTP 500
-
- Image viewer shows nothing / blank
Expected behavior
Preview thumbnail is generated and image displays in the viewer, just as it does for locally stored files or folder-level federated shares.
Actual behavior
/core/preview returns HTTP 500. The NC log shows:
[files] Backends provided no user object for buser1@remote-server
[index] Backends provided no user object
These errors appear exactly during the preview requests (verified via Apache access log correlation).
Root cause
For file-level federated shares, oc_filecache stores the file as the storage root:
| Field |
File-level share |
Folder-level share |
path |
"" (empty) |
"cleo.jpg" |
name |
"" (empty) |
"cleo.jpg" |
When the preview system processes a file with path="", it apparently resolves the user context as the federated share owner (user@remote-server) instead of the local authenticated user. Since the federated user has no local user object, the preview generation fails with NoUserException.
WebDAV access works fine: GET https://remote-server/public.php/webdav/ with the share token returns the correct file (HTTP 200, valid JPEG). The issue is exclusively in the preview system's user context handling.
Workaround
Have the remote user share a folder (not individual files). Files inside a folder share have proper path/name values and previews work correctly.
Environment
- Nextcloud Server version: 33.0.3.2
-
- Both servers: NC 33.0.3.2 (same version)
-
-
- PHP: 8.3 (Server B), 8.4 (Server A)
-
-
-
- OS: Debian (Server B: LXC container), Debian Trixie (Server A: Raspberry Pi)
-
-
-
-
- Apps:
federatedfilesharing: 1.23.0, cloud_federation_api: 1.17.0, federation_use_trusted_domains: yes
-
-
-
-
-
- Both servers mutual trusted: yes (status=1 in
oc_trusted_servers on both sides)
Related
Bug description
When a remote Nextcloud user shares a single file (not a folder) via Federated Share (OCM), the recipient's preview system returns HTTP 500 for all preview requests (
/core/preview?fileId=...).The root cause is that NC's preview system runs in the context of the federated share owner (
user@remote-server) instead of the local recipient. Since the federated user does not exist as a local user,OC\User\NoUserExceptionis thrown and the preview fails.This only affects file-level federated shares. Folder-level federated shares work correctly because the files inside have proper
pathandnamevalues inoc_filecache. File-level shares havepath=""andname=""(the storage root represents the file itself), which causes the preview system to use the wrong user context.Steps to reproduce
user1@remote-servershares a single file (e.g.cleo.jpg) as a Federated Share torecipient@your-server/core/preview?fileId=<id>&x=32&y=32&mimeFallback=true→ HTTP 500Expected behavior
Preview thumbnail is generated and image displays in the viewer, just as it does for locally stored files or folder-level federated shares.
Actual behavior
/core/previewreturns HTTP 500. The NC log shows:These errors appear exactly during the preview requests (verified via Apache access log correlation).
Root cause
For file-level federated shares,
oc_filecachestores the file as the storage root:path""(empty)"cleo.jpg"name""(empty)"cleo.jpg"When the preview system processes a file with
path="", it apparently resolves the user context as the federated share owner (user@remote-server) instead of the local authenticated user. Since the federated user has no local user object, the preview generation fails withNoUserException.WebDAV access works fine:
GET https://remote-server/public.php/webdav/with the share token returns the correct file (HTTP 200, valid JPEG). The issue is exclusively in the preview system's user context handling.Workaround
Have the remote user share a folder (not individual files). Files inside a folder share have proper
path/namevalues and previews work correctly.Environment
federatedfilesharing: 1.23.0,cloud_federation_api: 1.17.0,federation_use_trusted_domains: yesoc_trusted_serverson both sides)Related