Skip to content

Commit

Permalink
Fix OCM upload crush
Browse files Browse the repository at this point in the history
  • Loading branch information
2403905 committed Oct 14, 2024
1 parent 1ae1c24 commit e3d0a56
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
6 changes: 6 additions & 0 deletions changelog/unreleased/fix-ocm-upload-crush.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Bugfix: Fix OCM upload crush

We fixed an issue where a federated instance crashed when uploading a file to a remote folder.
Fixed the cleanup blob and meta of the uploaded files.

https://github.com/cs3org/reva/pull/4884
3 changes: 1 addition & 2 deletions pkg/ocm/storage/received/upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ func (u *upload) FinishUpload(ctx context.Context) error {
}
}

defer u.cleanup()
// compare if they match the sent checksum
// TODO the tus checksum extension would do this on every chunk, but I currently don't see an easy way to pass in the requested checksum. for now we do it in FinishUpload which is also called for chunked uploads
if u.Info.MetaData["checksum"] != "" {
Expand All @@ -316,7 +317,6 @@ func (u *upload) FinishUpload(ctx context.Context) error {
err = errtypes.BadRequest("unsupported checksum algorithm: " + parts[0])
}
if err != nil {
u.cleanup()
return err
}
}
Expand All @@ -336,7 +336,6 @@ func (u *upload) FinishUpload(ctx context.Context) error {
Path: filepath.Join(u.Info.MetaData["dir"], u.Info.MetaData["filename"]),
})
if err != nil {
u.cleanup()
return err
}

Expand Down
4 changes: 4 additions & 0 deletions pkg/rhttp/datatx/manager/tus/tus.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,10 @@ func (m *manager) Handler(fs storage.FS) (http.Handler, error) {
if err != nil {
appctx.GetLogger(context.Background()).Error().Err(err).Str("session", ev.Upload.ID).Msg("failed to list upload session")
} else {
if len(ups) < 1 {
appctx.GetLogger(context.Background()).Error().Str("session", ev.Upload.ID).Msg("upload session not found")
continue
}
up := ups[0]
executant := up.Executant()
ref := up.Reference()
Expand Down

0 comments on commit e3d0a56

Please sign in to comment.