Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Return X-WOPI-Lock when a manual lock from outside exists #442

Merged
merged 1 commit into from
May 16, 2023

Conversation

juliusknorr
Copy link
Member

@juliusknorr juliusknorr commented May 11, 2023

Signed-off-by: Julius Härtl [email protected]

Summary

This change makes sure that we return a proper locked response in cases where an outside lock exists.

I've tested this change with word, excel, powerpoint, however on my OOS server switching to read only mode only work with excel. I couldn't figure out a reason for that yet, but as it seems to work fine with excel it would rather assume this is a bug or misconfiguration of my OOS server.

Checklist

  • Code is properly formatted
  • Sign-off message is added to all commits
  • Documentation (manuals or wiki) has been updated or is not required

@enoch85
Copy link
Member

enoch85 commented May 11, 2023

Scenario 1

  1. User A created a new docx
  2. Share the file with user B
  3. User A opened the file locally (with "Edit locally" button in GUI)
  4. User B opened the file online

RESULT: User B got a pop up that the file can't be edited simultaneously, with an option to open in read only mode:
image

Scenario 2:

  1. User A created a new docx
  2. Share the file with user B
  3. User B opens the file
  4. User A opens the file

RESULT: File can be edited simultaneously by user A and user B.

I'd say tested and works!

@juliusknorr
Copy link
Member Author

Thanks a lot already. Just to double check does switching to the read only mode work for you for all file types (word/excel/PowerPoint)?

@enoch85
Copy link
Member

enoch85 commented May 11, 2023

Powerpoint:

Locking works, but not read only

image
image

Excel:
Does not even open as it seems (waited ~3 minutes):

image

More testing:
Now I only get internal server error...

{"reqId":"iDvMUGWEPhm3iVV7KzGl","level":3,"time":"2023-05-11T10:50:50+00:00","remoteAddr":"1.2.3.4","user":"[email protected]","app":"officeonline","method":"GET","url":"/apps/officeonline/public?shareToken=&fileName=%252FKollektiv%252FIT%2520S%25C3%25A4kerhetssamordning%252FAP-lista.xlsx&requesttoken=WWRb6zCt%2FyiomUicCRznI3bETeqWA0zp%2B7SSaAdlgQ8%3D%3AKgk0s2bFsF7jyTzPTl2yQiCrK676eTaFyeX7GW1ds2Y%3D&fileId=%7BfileId%7D","message":"Den beg\u00e4rda delningen finns inte mer","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36 Edg/112.0.1722.64","version":"26.0.1.1","exception":{"Exception":"OCP\\Share\\Exceptions\\ShareNotFound","Message":"Den beg\u00e4rda delningen finns inte mer","Code":0,"Trace":[{"file":"/srv/www/nextcloud/apps/officeonline/lib/Controller/DocumentController.php","line":349,"function":"getShareByToken","class":"OC\\Share20\\Manager","type":"->"},{"file":"/srv/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":230,"function":"publicPage","class":"OCA\\Officeonline\\Controller\\DocumentController","type":"->"},{"file":"/srv/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":137,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/srv/www/nextcloud/lib/private/AppFramework/App.php","line":183,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/srv/www/nextcloud/lib/private/Route/Router.php","line":315,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/srv/www/nextcloud/lib/base.php","line":1056,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/srv/www/nextcloud/index.php","line":36,"function":"handleRequest","class":"OC","type":"::"}],"File":"/srv/www/nextcloud/lib/private/Share20/Manager.php","Line":1537,"Hint":"Den beg\u00e4rda delningen finns inte mer","CustomMessage":"--"}}
{"reqId":"Ov03BXGfHe67oJemiEsr","level":3,"time":"2023-05-11T11:43:48+00:00","remoteAddr":"1.2.3.4","user":"[email protected]","app":"webdav","method":"POST","url":"/remote.php/dav/bulk","message":"Unknown error while seeking content","userAgent":"Mozilla/5.0 (Windows) mirall/3.8.1stable-Win64 (build 20230419) (Nextcloud, windows-10.0.19045 ClientArchitecture: x86_64 OsArchitecture: x86_64)","version":"26.0.1.1","exception":{"Exception":"Sabre\\DAV\\Exception","Message":"Unknown error while seeking content","Code":500,"Trace":[{"file":"/srv/www/nextcloud/apps/dav/lib/BulkUpload/MultipartRequestParser.php","line":129,"function":"isAt","class":"OCA\\DAV\\BulkUpload\\MultipartRequestParser","type":"->"},{"file":"/srv/www/nextcloud/apps/dav/lib/BulkUpload/BulkUploadPlugin.php","line":71,"function":"isAtLastBoundary","class":"OCA\\DAV\\BulkUpload\\MultipartRequestParser","type":"->"},{"file":"/srv/www/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php","line":89,"function":"httpPost","class":"OCA\\DAV\\BulkUpload\\BulkUploadPlugin","type":"->"},{"file":"/srv/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":472,"function":"emit","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/srv/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":253,"function":"invokeMethod","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/srv/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":321,"function":"start","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/srv/www/nextcloud/apps/dav/lib/Server.php","line":366,"function":"exec","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/srv/www/nextcloud/apps/dav/appinfo/v2/remote.php","line":35,"function":"exec","class":"OCA\\DAV\\Server","type":"->"},{"file":"/srv/www/nextcloud/remote.php","line":172,"args":["/srv/www/nextcloud/apps/dav/appinfo/v2/remote.php"],"function":"require_once"}],"File":"/srv/www/nextcloud/apps/dav/lib/BulkUpload/MultipartRequestParser.php","Line":111,"message":"Unknown error while seeking content","exception":{},"CustomMessage":"Unknown error while seeking content"}}
{"reqId":"wwtKXR1rrbE9X9aDue8H","level":4,"time":"2023-05-11T12:22:24+00:00","remoteAddr":"1.2.3.4","user":"--","app":"user_saml","method":"POST","url":"/apps/user_saml/saml/acs","message":"invalid_response","userAgent":"Mozilla/5.0 (iOS) NextcloudNotes/4.1.7","version":"26.0.1.1","data":{"app":"user_saml"}}
{"reqId":"wwtKXR1rrbE9X9aDue8H","level":4,"time":"2023-05-11T12:22:24+00:00","remoteAddr":"1.2.3.4","user":"--","app":"user_saml","method":"POST","url":"/apps/user_saml/saml/acs","message":"The status code of the Response was not Success, was Responder -> urn:oasis:names:tc:SAML:2.0:status:RequestDenied","userAgent":"Mozilla/5.0 (iOS) NextcloudNotes/4.1.7","version":"26.0.1.1","data":{"app":"user_saml"}}
{"reqId":"fqQV3UA8LdECOzhtjWst","level":3,"time":"2023-05-11T14:07:10+00:00","remoteAddr":"1.2.3.4","user":"danh","app":"no app in context","method":"POST","url":"/ocs/v2.php/apps/files_sharing/api/v1/shares","message":"Path contains files shared with you","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/112.0","version":"26.0.1.1","exception":{"Exception":"InvalidArgumentException","Message":"Path contains files shared with you","Code":0,"Trace":[{"file":"/srv/www/nextcloud/lib/private/Share20/Manager.php","line":727,"function":"pathCreateChecks","class":"OC\\Share20\\Manager","type":"->"},{"file":"/srv/www/nextcloud/apps/files_sharing/lib/Controller/ShareAPIController.php","line":720,"function":"createShare","class":"OC\\Share20\\Manager","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/srv/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":230,"function":"createShare","class":"OCA\\Files_Sharing\\Controller\\ShareAPIController","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/srv/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":137,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/srv/www/nextcloud/lib/private/AppFramework/App.php","line":183,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/srv/www/nextcloud/lib/private/Route/Router.php","line":315,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/srv/www/nextcloud/ocs/v1.php","line":64,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/srv/www/nextcloud/ocs/v2.php","line":23,"args":["/srv/www/nextcloud/ocs/v1.php"],"function":"require_once"}],"File":"/srv/www/nextcloud/lib/private/Share20/Manager.php","Line":690,"CustomMessage":"--"}}




@enoch85
Copy link
Member

enoch85 commented May 11, 2023

Also noted, the actual internal server error doesn't get logged anywhere afaik.

@juliusknorr
Copy link
Member Author

The log messages indeed don't look related.

Now I only get internal server error...

How do you trigger that and where you see it? Is there a request id mentioned in the output that could help find the log messages?

@juliusknorr
Copy link
Member Author

Regarding the error that powerpoint shows, are you able to find something meaninful regaring the session id in the OOS server logs? I had a hard time checking those and also haven't noticed any message on mine that would indicate an error.

@juliusknorr juliusknorr marked this pull request as ready for review May 12, 2023 10:50
@juliusknorr juliusknorr added 3. to review Waiting for reviews bug Something isn't working labels May 12, 2023
@juliusknorr
Copy link
Member Author

Had one more confirmation that this fixes the issue as expected.

@enoch85
Copy link
Member

enoch85 commented May 12, 2023

How do you trigger that and where you see it? Is there a request id mentioned in the output that could help find the log messages?

I just try to open the document in the web as usual. Might have been something temporary.

Regarding the error that powerpoint shows, are you able to find something meaninful regaring the session id in the OOS server logs?

Does OSS have seperate sevrer logs? 🤷‍♂️

@juliusknorr
Copy link
Member Author

Yes, see https://learn.microsoft.com/en-us/compliance/regulatory/gdpr-for-office-online-server and https://sharepoint.stackexchange.com/questions/286061/where-is-oos-loglocation-path-for-win2019

But I haven't found any useful message in there on my setup

@blizzz blizzz merged commit 55a346c into main May 16, 2023
@delete-merged-branch delete-merged-branch bot deleted the bugfix/428 branch May 16, 2023 07:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Office online does not respect a local locked file by user.
3 participants