Skip to content

Commit

Permalink
fix: wopi lock header in get lock response
Browse files Browse the repository at this point in the history
  • Loading branch information
micbar committed Nov 5, 2024
1 parent 786efd3 commit dddc6fb
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
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

0 comments on commit dddc6fb

Please sign in to comment.