nextcloud / officeonline

officeonline
43 stars 15 forks source link

Shared links do not allow editing or preview #536

Open toreonify opened 5 months ago

toreonify commented 5 months ago

Describe the bug When sharing a document for everyone with a link, Nextcloud won't open document for reading or editing if allowed. Only option is to download a file.

To Reproduce Steps to reproduce the behavior:

  1. Create a new document or get an existing one
  2. Enable shared access by link
  3. Copy generated link
  4. Open in a clean browser session without a user logged in to Nextcloud

Expected behavior Link opens a document in Nextcloud, Office Online starts loading document and allows reading or editing, depending on access mode.

Screenshots

Document shared by link: Screenshot_20240317_153020

Link opened in incognito mode: Screenshot_20240317_153044

Client details:

Server details

Operating system: ALT Linux Server 10.2

Web server: nginx

Database: PostgreSQL 15.5

PHP version: 8.2.15

Nextcloud version: 28.0.2

Version of the officeonline app: 2.1.0

Version of Office Online server: 16.0.6814.2226

Logs #### Nextcloud log (data/nextcloud.log) This log entry appeared at a different time than opening a document, maybe it is not about this issue or document. ``` {"reqId":"jQ8pjskdCFRYno9WXTd2","level":3,"time":"2024-03-17T12:29:04+00:00","remoteAddr":"10.16.0.173","user":"--","app":"index","method":"GET","url":"/index.php/apps/officeonline/wopi/files/13799_ocevqxe2k8p5","message":"Call to a member function getFileid() on null in file '/var/lib/nextcloud/apps/officeonline/lib/Middleware/WOPIMiddleware.php' line 77","userAgent":"MSWAC","version":"28.0.2.5","exception":{"Exception":"Exception","Message":"Call to a member function getFileid() on null in file '/var/lib/nextcloud/apps/officeonline/lib/Middleware/WOPIMiddleware.php' line 77","Code":0,"Trace":[{"file":"/var/www/nextcloud/lib/private/AppFramework/App.php","line":184,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OCA\\Officeonline\\Controller\\WopiController"],"checkFileInfo"]},{"file":"/var/www/nextcloud/lib/private/Route/Router.php","line":315,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Officeonline\\Controller\\WopiController","checkFileInfo",["OC\\AppFramework\\DependencyInjection\\DIContainer"],["13799_ocevqxe2k8p5","officeonline.wopi.checkFileInfo"]]},{"file":"/var/www/nextcloud/lib/base.php","line":1069,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/apps/officeonline/wopi/files/13799_ocevqxe2k8p5"]},{"file":"/var/www/nextcloud/index.php","line":39,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","Line":169,"Previous":{"Exception":"Error","Message":"Call to a member function getFileid() on null","Code":0,"Trace":[{"file":"/var/www/nextcloud/lib/private/AppFramework/Middleware/MiddlewareDispatcher.php","line":96,"function":"beforeController","class":"OCA\\Officeonline\\Middleware\\WOPIMiddleware","type":"->","args":[["OCA\\Officeonline\\Controller\\WopiController"],"checkFileInfo"]},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":129,"function":"beforeController","class":"OC\\AppFramework\\Middleware\\MiddlewareDispatcher","type":"->","args":[["OCA\\Officeonline\\Controller\\WopiController"],"checkFileInfo"]},{"file":"/var/www/nextcloud/lib/private/AppFramework/App.php","line":184,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OCA\\Officeonline\\Controller\\WopiController"],"checkFileInfo"]},{"file":"/var/www/nextcloud/lib/private/Route/Router.php","line":315,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Officeonline\\Controller\\WopiController","checkFileInfo",["OC\\AppFramework\\DependencyInjection\\DIContainer"],["13799_ocevqxe2k8p5","officeonline.wopi.checkFileInfo"]]},{"file":"/var/www/nextcloud/lib/base.php","line":1069,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/apps/officeonline/wopi/files/13799_ocevqxe2k8p5"]},{"file":"/var/www/nextcloud/index.php","line":39,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/lib/nextcloud/apps/officeonline/lib/Middleware/WOPIMiddleware.php","Line":77},"message":"Call to a member function getFileid() on null in file '/var/lib/nextcloud/apps/officeonline/lib/Middleware/WOPIMiddleware.php' line 77","exception":{},"CustomMessage":"Call to a member function getFileid() on null in file '/var/lib/nextcloud/apps/officeonline/lib/Middleware/WOPIMiddleware.php' line 77"}} ```
Orchal commented 5 months ago

Hi,

it does work only if you share a folder with a document in there, but not the document itself.

toreonify commented 5 months ago

Hi,

it does work only if you share a folder with a document in there, but not the document itself.

Wow. I'll test this later, thank you for the clue.

But why this behavior isn't mentioned anywhere? Still, sharing a folder is not the same as a document with different permissions for each.

Orchal commented 5 months ago

I don't think it's intended, it's more likely a workaround, so I guess your issue is still relevant!

snagirnyi commented 4 months ago

Hi, after update OfficeOnline from 1.1.2 to 2.1.0 and update to 28.0.3 we have a problem with open shared documents. Nextcloud won't open document for reading or editing if allowed. Only option is to download a file. But if shared forlder with a document, all working.

leveler48ru commented 4 months ago

This is a important task. Users want to be able to view and edit content directly from a shared link.