From 3dbdcc507843bac442524b10e6801b68395e6617 Mon Sep 17 00:00:00 2001 From: Andre Duffeck Date: Mon, 14 Nov 2022 13:16:33 +0100 Subject: [PATCH] Set oc fileid header (#3458) * Set the Oc-Fileid header when copying items * Add changelog --- changelog/unreleased/set-oc-fileid-header.md | 6 ++++++ internal/http/services/owncloud/ocdav/copy.go | 7 +++++++ 2 files changed, 13 insertions(+) create mode 100644 changelog/unreleased/set-oc-fileid-header.md diff --git a/changelog/unreleased/set-oc-fileid-header.md b/changelog/unreleased/set-oc-fileid-header.md new file mode 100644 index 0000000000..ad69ca2885 --- /dev/null +++ b/changelog/unreleased/set-oc-fileid-header.md @@ -0,0 +1,6 @@ +Bugfix: Set the Oc-Fileid header when copying items + +We added the Oc-Fileid header in the COPY response for compatibility reasons. + +https://github.com/cs3org/reva/pull/3458 +https://github.com/owncloud/ocis/issues/5039 diff --git a/internal/http/services/owncloud/ocdav/copy.go b/internal/http/services/owncloud/ocdav/copy.go index 41cb2030ba..e944a7168e 100644 --- a/internal/http/services/owncloud/ocdav/copy.go +++ b/internal/http/services/owncloud/ocdav/copy.go @@ -279,6 +279,9 @@ func (s *svc) executePathCopy(ctx context.Context, client gateway.GatewayAPIClie return err } + if fileid := httpUploadRes.Header.Get(net.HeaderOCFileID); fileid != "" { + w.Header().Set(net.HeaderOCFileID, fileid) + } } return nil } @@ -468,6 +471,10 @@ func (s *svc) executeSpacesCopy(ctx context.Context, w http.ResponseWriter, clie if httpUploadRes.StatusCode != http.StatusOK { return err } + + if fileid := httpUploadRes.Header.Get(net.HeaderOCFileID); fileid != "" { + w.Header().Set(net.HeaderOCFileID, fileid) + } } return nil }