Use the default server download protocol if spaces are not supported

This commit is contained in:
Ishank Arora
2022-03-24 16:01:04 +01:00
parent 23571e7d47
commit 241003220c
2 changed files with 7 additions and 0 deletions
@@ -0,0 +1,3 @@
Bugfix: Use the default server download protocol if spaces are not supported
https://github.com/owncloud/ocis/pull/3386
@@ -74,8 +74,12 @@ func (s CS3) Get(ctx context.Context, path string) (io.ReadCloser, error) {
for _, p := range rsp.Protocols {
if p.Protocol == "spaces" {
ep, tk = p.DownloadEndpoint, p.Token
break
}
}
if (ep == "" || tk == "") && len(rsp.Protocols) > 0 {
ep, tk = rsp.Protocols[0].DownloadEndpoint, rsp.Protocols[0].Token
}
httpReq, err := rhttp.NewRequest(ctx, "GET", ep, nil)
if err != nil {