From 241003220c1a00c6058577464cf7f238d65698e6 Mon Sep 17 00:00:00 2001 From: Ishank Arora Date: Thu, 24 Mar 2022 16:01:00 +0100 Subject: [PATCH] Use the default server download protocol if spaces are not supported --- changelog/unreleased/thumbnails-download-fix.md | 3 +++ thumbnails/pkg/thumbnail/imgsource/cs3.go | 4 ++++ 2 files changed, 7 insertions(+) create mode 100644 changelog/unreleased/thumbnails-download-fix.md diff --git a/changelog/unreleased/thumbnails-download-fix.md b/changelog/unreleased/thumbnails-download-fix.md new file mode 100644 index 00000000000..cb8cc5a9189 --- /dev/null +++ b/changelog/unreleased/thumbnails-download-fix.md @@ -0,0 +1,3 @@ +Bugfix: Use the default server download protocol if spaces are not supported + +https://github.com/owncloud/ocis/pull/3386 \ No newline at end of file diff --git a/thumbnails/pkg/thumbnail/imgsource/cs3.go b/thumbnails/pkg/thumbnail/imgsource/cs3.go index 37b7686d70f..d7343e72f77 100644 --- a/thumbnails/pkg/thumbnail/imgsource/cs3.go +++ b/thumbnails/pkg/thumbnail/imgsource/cs3.go @@ -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 {