From cd8c14194a0da6e760d8a32de9338d62d4d6f65d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Duffeck?= Date: Wed, 20 Dec 2023 12:53:25 +0100 Subject: [PATCH 1/2] Fall back to tus upload if the TouchFile shortcut fails w/ already exists Fixes https://github.com/owncloud/ocis/issues/8003 --- internal/http/services/owncloud/ocdav/tus.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/internal/http/services/owncloud/ocdav/tus.go b/internal/http/services/owncloud/ocdav/tus.go index 6fbbbb6e43..d3592f1ab7 100644 --- a/internal/http/services/owncloud/ocdav/tus.go +++ b/internal/http/services/owncloud/ocdav/tus.go @@ -175,7 +175,13 @@ func (s *svc) handleTusPost(ctx context.Context, w http.ResponseWriter, r *http. w.WriteHeader(http.StatusInternalServerError) return } - if tfRes.Status.Code != rpc.Code_CODE_OK { + switch tfRes.Status.Code { + case rpc.Code_CODE_OK: + w.WriteHeader(http.StatusCreated) + return + case rpc.Code_CODE_ALREADY_EXISTS: + // Fall through to the tus case + default: log.Error().Interface("status", tfRes.Status).Msg("error touching file") w.WriteHeader(http.StatusInternalServerError) return From 93b4dd91a8b3a4e518d97900d596abe8db75f708 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Duffeck?= Date: Wed, 20 Dec 2023 12:56:44 +0100 Subject: [PATCH 2/2] Add changelog --- changelog/unreleased/fix-0-byte-overwrites.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 changelog/unreleased/fix-0-byte-overwrites.md diff --git a/changelog/unreleased/fix-0-byte-overwrites.md b/changelog/unreleased/fix-0-byte-overwrites.md new file mode 100644 index 0000000000..5f32db7ba7 --- /dev/null +++ b/changelog/unreleased/fix-0-byte-overwrites.md @@ -0,0 +1,5 @@ +Bugfix: Fix overwriting files with empty files + +We fixed a bug where files could not be overwritten with empty files using the desktop client. + +https://github.com/cs3org/reva/pull/4425