{"reqId":"z8P6WciD4t2fhx0WgRaz","level":3,"time":"2026-09-03 07:16:37","remoteAddr":"192.168.193.165","user":"--","app":"index","method":"GET","url":"/apps/files_sharing/publicpreview/roL68HA6983KtHw?x=-1&y=384&a=1","scriptName":"/index.php","message":"OC\\PreviewManager::getPreview(): Argument #1 ($file) must be of type OCP\\Files\\File, OC\\Files\\Node\\Folder given, called in /var/www/html/apps/files_sharing/lib/Controller/PublicPreviewController.php on line 133 in file '/var/www/html/lib/private/PreviewManager.php' line 171","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/152.0.0.0 Safari/537.36","version":"34.0.3.2","exception":{"Exception":"Exception","Message":"OC\\PreviewManager::getPreview(): Argument #1 ($file) must be of type OCP\\Files\\File, OC\\Files\\Node\\Folder given, called in /var/www/html/apps/files_sharing/lib/Controller/PublicPreviewController.php on line 133 in file '/var/www/html/lib/private/PreviewManager.php' line 171","Code":0,"Trace":[{"file":"/var/www/html/lib/private/AppFramework/App.php","line":137,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\Files_Sharing\\Controller\\PublicPreviewController"},"getPreview"]},{"file":"/var/www/html/lib/private/Route/Router.php","line":324,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Files_Sharing\\Controller\\PublicPreviewController","getPreview",{"__class__":"OC\\AppFramework\\DependencyInjection\\DIContainer"},{"_route":"files_sharing.publicpreview.getpreview","token":"roL68HA6983KtHw"}]},{"file":"/var/www/html/lib/base.php","line":1172,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/apps/files_sharing/publicpreview/roL68HA6983KtHw"]},{"file":"/var/www/html/index.php","line":25,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","Line":110,"Previous":{"Exception":"TypeError","Message":"OC\\PreviewManager::getPreview(): Argument #1 ($file) must be of type OCP\\Files\\File, OC\\Files\\Node\\Folder given, called in /var/www/html/apps/files_sharing/lib/Controller/PublicPreviewController.php on line 133","Code":0,"Trace":[{"file":"/var/www/html/apps/files_sharing/lib/Controller/PublicPreviewController.php","line":133,"function":"getPreview","class":"OC\\PreviewManager","type":"->","args":[{"__class__":"OC\\Files\\Node\\Folder"},-1,384,false]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":165,"function":"getPreview","class":"OCA\\Files_Sharing\\Controller\\PublicPreviewController","type":"->","args":["roL68HA6983KtHw",{"__class__":"OC\\Files\\Node\\Folder"},-1,384,true,false]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":78,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\Files_Sharing\\Controller\\PublicPreviewController"},"getPreview"]},{"file":"/var/www/html/lib/private/AppFramework/App.php","line":137,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\Files_Sharing\\Controller\\PublicPreviewController"},"getPreview"]},{"file":"/var/www/html/lib/private/Route/Router.php","line":324,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Files_Sharing\\Controller\\PublicPreviewController","getPreview",{"__class__":"OC\\AppFramework\\DependencyInjection\\DIContainer"},{"_route":"files_sharing.publicpreview.getpreview","token":"roL68HA6983KtHw"}]},{"file":"/var/www/html/lib/base.php","line":1172,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/apps/files_sharing/publicpreview/roL68HA6983KtHw"]},{"file":"/var/www/html/index.php","line":25,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/html/lib/private/PreviewManager.php","Line":171},"message":"OC\\PreviewManager::getPreview(): Argument #1 ($file) must be of type OCP\\Files\\File, OC\\Files\\Node\\Folder given, called in /var/www/html/apps/files_sharing/lib/Controller/PublicPreviewController.php on line 133 in file '/var/www/html/lib/private/PreviewManager.php' line 171","exception":"{\"class\":\"Exception\",\"message\":\"OC\\PreviewManager::getPreview(): Argument #1 ($file) must be of type OCP\\Files\\File, OC\\Files\\Node\\Folder given, called in /var/www/html/apps/files_sharing/lib/Controller/PublicPreviewController.php on line 133 in file '/var/www/html/lib/private/PreviewManager.php' line 171\",\"code\":0,\"file\":\"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php:110\",\"trace\":\"#0 /var/www/html/lib/private/AppFramework/App.php(137): OC\\AppFramework\\Http\\Dispatcher->dispatch(Object(OCA\\Files_Sharing\\Controller\\PublicPreviewController), 'getPreview')\\n#1 /var/www/html/lib/private/Route/Router.php(324): OC\\AppFramework\\App::main('OCA\\\\Files_Shari...', 'getPreview', Object(OC\\AppFramework\\DependencyInjection\\DIContainer), Array)\\n#2 /var/www/html/lib/base.php(1172): OC\\Route\\Router->match('/apps/files_sha...')\\n#3 /var/www/html/index.php(25): OC::handleRequest()\\n#4 {main}\",\"previous\":{\"class\":\"TypeError\",\"message\":\"OC\\PreviewManager::getPreview(): Argument #1 ($file) must be of type OCP\\Files\\File, OC\\Files\\Node\\Folder given, called in /var/www/html/apps/files_sharing/lib/Controller/PublicPreviewController.php on line 133\",\"code\":0,\"file\":\"/var/www/html/lib/private/PreviewManager.php:171\",\"trace\":\"#0 /var/www/html/apps/files_sharing/lib/Controller/PublicPreviewController.php(133): OC\\PreviewManager->getPreview(Object(OC\\Files\\Node\\Folder), -1, 384, false)\\n#1 /var/www/html/lib/private/AppFramework/Http/Dispatcher.php(165): OCA\\Files_Sharing\\Controller\\PublicPreviewController->getPreview('roL68HA6983KtHw', Object(OC\\Files\\Node\\Folder), -1, 384, true, false)\\n#2 /var/www/html/lib/private/AppFramework/Http/Dispatcher.php(78): OC\\AppFramework\\Http\\Dispatcher->executeController(Object(OCA\\Files_Sharing\\Controller\\PublicPreviewController), 'getPreview')\\n#3 /var/www/html/lib/private/AppFramework/App.php(137): OC\\AppFramework\\Http\\Dispatcher->dispatch(Object(OCA\\Files_Sharing\\Controller\\PublicPreviewController), 'getPreview')\\n#4 /var/www/html/lib/private/Route/Router.php(324): OC\\AppFramework\\App::main('OCA\\\\Files_Shari...', 'getPreview', Object(OC\\AppFramework\\DependencyInjection\\DIContainer), Array)\\n#5 /var/www/html/lib/base.php(1172): OC\\Route\\Router->match('/apps/files_sha...')\\n#6 /var/www/html/index.php(25): OC::handleRequest()\\n#7 {main}\"}}","CustomMessage":"OC\\PreviewManager::getPreview(): Argument #1 ($file) must be of type OCP\\Files\\File, OC\\Files\\Node\\Folder given, called in /var/www/html/apps/files_sharing/lib/Controller/PublicPreviewController.php on line 133 in file '/var/www/html/lib/private/PreviewManager.php' line 171"}}
Tip
How to use GitHub
This looks like a regression of old and closed issues, for example #4471 or #2309.
Steps to reproduce
The following URL (example) gets a 500 error and no other detail:
https://mysite/apps/files_sharing/publicpreview/roL68HA6983KtHw?x=-1&y=384&a=1
Additional steps:
5. Click on the image, it opens a public share where the image is displayed
6. In that new context the preview is visible
The associated URL (example) is:
https://mysite/apps/files_sharing/publicpreview/roL68HA6983KtHw?file=%2FIMG_20260823_190436.jpg&x=32&y=32&mimeFallback=true&v=858990&a=0
7. If I add (using curl) "file=" to the first (failing) URL above, it works
8. All the previews work correctly if the user is logged in. The problem above only occurs for guests
Alternative scenario: same as above but using "Share from Files" (globally this should be checked with all the ways to share items).
Expected behaviour
The previews should work for guests of public conversations.
Actual behaviour
The previews in the public conversations fail when files were shared with "Upload from device"
Alternative scenario: Some of the previews in the public conversations fail when files were shared with "Share from Files"
Talk app
Talk app version: 24.0.4
Custom Signaling server configured: no
Custom TURN server configured: no
Custom STUN server configured: no
Browser
Microphone available: no
Camera available: no
Operating system: Ubuntu
Browser name: Firefox/Chromium
Browser version: Firefox 154/ Chromium 152
Browser log
Failed to load resource: the server responded with a status of 500 ()
GET
https://mysite/apps/files_sharing/publicpreview/roL68HA6983KtHw?x=-1&y=384&a=1
[HTTP/2 500 96ms]
(same kind of log for the alternative scenario)
Server configuration
Operating system: Debian (host that runs nextcloud through helm)
Web server: Apache/Nginx
Database: PostgreSQL
PHP version: 8.5.10
Nextcloud Version: 34.0.3
List of activated apps:
Details
Nextcloud configuration:
Details
Server log (data/nextcloud.log)
Details
When using the alternative scenario:
Details
``` { "reqId": "8wj42mLCTFmiVKGVyd2d", "level": 3, "time": "2026-09-03 07:33:14", "remoteAddr": "192.168.193.165", "user": "--", "app": "index", "method": "GET", "url": "/apps/files_sharing/publicpreview/tRD7CooDggB9EYo?x=-1&y=384&a=1", "scriptName": "/index.php", "message": "An exception occurred while executing a query: SQLSTATE[42702]: Ambiguous column: 7 ERROR: column reference \"file_id\" is ambiguous\nLINE 1: ...rsions\" \"v\" ON \"p\".\"version_id\" = \"v\".\"id\" WHERE (\"file_id\" ...\n ^", "userAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/152.0.0.0 Safari/537.36", "version": "34.0.3.2", "exception": { "Exception": "OC\\DB\\Exceptions\\DbalException", "Message": "An exception occurred while executing a query: SQLSTATE[42702]: Ambiguous column: 7 ERROR: column reference \"file_id\" is ambiguous\nLINE 1: ...rsions\" \"v\" ON \"p\".\"version_id\" = \"v\".\"id\" WHERE (\"file_id\" ...\n ^", "Code": 7, "Trace": [ { "file": "/var/www/html/lib/private/DB/ConnectionAdapter.php", "line": 60, "function": "wrap", "class": "OC\\DB\\Exceptions\\DbalException", "type": "::", "args": [ { "__class__": "Doctrine\\DBAL\\Exception\\NonUniqueFieldNameException" }, "", "SELECT `p`.*, `l`.`bucket_name`, `l`.`object_store_name`, `v`.`version` FROM `*PREFIX*previews` `p` LEFT JOIN `*PREFIX*preview_locations` `l` ON `p`.`location_id` = `l`.`id` LEFT JOIN `*PREFIX*preview_versions` `v` ON `p`.`version_id` = `v`.`id` WHERE (`file_id` = :dcValue1) AND (`width` = :dcValue2) AND (`height` = :dcValue3) AND (`mimetype_id` = :dcValue4) AND (`cropped` = :dcValue5) AND (`version_id` = :dcValue6)" ] }, { "file": "/var/www/html/lib/private/DB/QueryBuilder/QueryBuilder.php", "line": 261, "function": "executeQuery", "class": "OC\\DB\\ConnectionAdapter", "type": "->", "args": [ "SELECT `p`.*, `l`.`bucket_name`, `l`.`object_store_name`, `v`.`version` FROM `*PREFIX*previews` `p` LEFT JOIN `*PREFIX*preview_locations` `l` ON `p`.`location_id` = `l`.`id` LEFT JOIN `*PREFIX*preview_versions` `v` ON `p`.`version_id` = `v`.`id` WHERE (`file_id` = :dcValue1) AND (`width` = :dcValue2) AND (`height` = :dcValue3) AND (`mimetype_id` = :dcValue4) AND (`cropped` = :dcValue5) AND (`version_id` = :dcValue6)", { "dcValue1": 137, "dcValue2": 1024, "dcValue3": 576, "dcValue4": 10, "dcValue5": false, "0": "And 1 more entries, set log level to debug to see all entries" }, { "dcValue1": 2, "dcValue2": 2, "dcValue3": 2, "dcValue4": 2, "dcValue5": 2, "0": "And 1 more entries, set log level to debug to see all entries" } ] }, (...) } ```