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: wopi lock header in get lock response #10470

Merged
merged 1 commit into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions changelog/unreleased/fix-get-lock-header.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Bugfix: Return wopi lock header in get lock response

We fixed a bug where the wopi lock header was not returned in the get lock response. This is now fixed and the wopi validator tests are passing.

https://github.com/owncloud/ocis/pull/10469
6 changes: 4 additions & 2 deletions services/collaboration/pkg/connector/fileconnector.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,10 @@ func (f *FileConnector) GetLock(ctx context.Context) (*ConnectorResponse, error)
Str("StatusCode", resp.GetStatus().GetCode().String()).
Str("StatusMsg", resp.GetStatus().GetMessage()).
Msg("GetLock failed with unexpected status")
// TODO: Should we be more strict? There could be more causes for the failure
return NewResponse(404), nil
// Return 404 and the required header, even if it's empty
// https://docs.microsoft.com/en-us/microsoft-365/cloud-storage-partner-program/rest/files/getlock#response-headers
// This is needed to fulfill the requirements of online WOPI validator
return NewResponseWithLock(404, ""), nil
}

lockID := ""
Expand Down
2 changes: 1 addition & 1 deletion services/collaboration/pkg/connector/fileconnector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ var _ = Describe("FileConnector", func() {
response, err := fc.GetLock(ctx)
Expect(err).ToNot(HaveOccurred())
Expect(response.Status).To(Equal(404))
Expect(response.Headers).To(BeNil())
Expect(response.Headers[connector.HeaderWopiLock]).To(Equal(""))
})

It("Get lock success", func() {
Expand Down