Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix overwriting files with empty files #4425

Merged
merged 2 commits into from Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions 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
8 changes: 7 additions & 1 deletion internal/http/services/owncloud/ocdav/tus.go
Expand Up @@ -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
Expand Down