fix: wopi lock header in get lock response

This commit is contained in:
Michael Barz
2024-11-05 14:19:49 +01:00
parent 786efd367e
commit dddc6fbdb5
3 changed files with 10 additions and 3 deletions

View File

@@ -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

View File

@@ -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 := ""

View File

@@ -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() {