diff --git a/changelog/unreleased/fix-upload-session-bugs.md b/changelog/unreleased/fix-upload-session-bugs.md new file mode 100644 index 0000000000..bee1b9416b --- /dev/null +++ b/changelog/unreleased/fix-upload-session-bugs.md @@ -0,0 +1,5 @@ +Bugfix: Fix upload session bugs + +We fixed an issue that caused a panic when we could not open a file to calculate checksums. Furthermore, we now delete the upload session .lock file on cleanup. + +https://github.com/cs3org/reva/pull/4888 diff --git a/pkg/storage/utils/decomposedfs/upload/session.go b/pkg/storage/utils/decomposedfs/upload/session.go index a83d5f46b5..072e32e3c2 100644 --- a/pkg/storage/utils/decomposedfs/upload/session.go +++ b/pkg/storage/utils/decomposedfs/upload/session.go @@ -86,7 +86,10 @@ func (s *OcisSession) Purge(ctx context.Context) error { if err != nil { return err } - defer f.Close() + defer func() { + f.Close() + os.Remove(sessionPath + ".lock") + }() if err := os.Remove(sessionPath); err != nil { return err } diff --git a/pkg/storage/utils/decomposedfs/upload/upload.go b/pkg/storage/utils/decomposedfs/upload/upload.go index 0c41b8f759..f3a2fed476 100644 --- a/pkg/storage/utils/decomposedfs/upload/upload.go +++ b/pkg/storage/utils/decomposedfs/upload/upload.go @@ -115,7 +115,7 @@ func (session *OcisSession) FinishUpload(ctx context.Context) error { sha1h, md5h, adler32h, err := node.CalculateChecksums(ctx, session.binPath()) if err != nil { - log.Info().Err(err).Msg("error copying checksums") + return err } // compare if they match the sent checksum