From e3d669e1593fa8313d74dc588a8d0382d91d81b8 Mon Sep 17 00:00:00 2001 From: Roman Perekhod Date: Tue, 23 Jul 2024 12:49:00 +0200 Subject: [PATCH] fixed the response code when copying the file from shares to personal space --- changelog/unreleased/fix-copy-responce.md | 6 ++++++ internal/http/services/owncloud/ocdav/copy.go | 6 ++++++ 2 files changed, 12 insertions(+) create mode 100644 changelog/unreleased/fix-copy-responce.md diff --git a/changelog/unreleased/fix-copy-responce.md b/changelog/unreleased/fix-copy-responce.md new file mode 100644 index 0000000000..3ebbae2ad7 --- /dev/null +++ b/changelog/unreleased/fix-copy-responce.md @@ -0,0 +1,6 @@ +Bugfix: Fixed the response code when copying the shared from to personal + +We fixed the response code when copying the file from shares to personal space with a secure view role. + +https://github.com/cs3org/reva/pull/4775 +https://github.com/owncloud/ocis/issues/9482 diff --git a/internal/http/services/owncloud/ocdav/copy.go b/internal/http/services/owncloud/ocdav/copy.go index 97b4686420..e575bdda76 100644 --- a/internal/http/services/owncloud/ocdav/copy.go +++ b/internal/http/services/owncloud/ocdav/copy.go @@ -511,6 +511,12 @@ func (s *svc) executeSpacesCopy(ctx context.Context, w http.ResponseWriter, sele return err } defer httpDownloadRes.Body.Close() + if httpDownloadRes.StatusCode == http.StatusForbidden { + w.WriteHeader(http.StatusForbidden) + b, err := errors.Marshal(http.StatusForbidden, http.StatusText(http.StatusForbidden), "", strconv.Itoa(http.StatusForbidden)) + errors.HandleWebdavError(log, w, b, err) + return nil + } if httpDownloadRes.StatusCode != http.StatusOK { return fmt.Errorf("status code %d", httpDownloadRes.StatusCode) }