Skip to content

Commit

Permalink
fix upload session bugs
Browse files Browse the repository at this point in the history
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
  • Loading branch information
butonic committed Oct 16, 2024
1 parent a322d4a commit 4ee3e39
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
5 changes: 5 additions & 0 deletions changelog/unreleased/fix-upload-session-bugs.md
Original file line number Diff line number Diff line change
@@ -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
5 changes: 4 additions & 1 deletion pkg/storage/utils/decomposedfs/upload/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/storage/utils/decomposedfs/upload/upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4ee3e39

Please sign in to comment.