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 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