Skip to content

Commit

Permalink
Merge pull request #4425 from aduffeck/fix-truncating-files
Browse files Browse the repository at this point in the history
Fix overwriting files with empty files
  • Loading branch information
aduffeck committed Dec 21, 2023
2 parents 85c7bdc + 93b4dd9 commit 146de63
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
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

0 comments on commit 146de63

Please sign in to comment.