Skip to content

Commit

Permalink
Close storage objects before cleaning (#16934)
Browse files Browse the repository at this point in the history
Storage.Iterate provides the path and an open object. On windows using
local storage means that the objects will be locked thus preventing clean
from deleting them.

This PR simply closes the objects early.

Fix #16932

Signed-off-by: Andrew Thornton <art27@cantab.net>
  • Loading branch information
zeripath authored Sep 3, 2021
1 parent 6c125e9 commit 076bb8a
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions modules/storage/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ func Copy(dstStorage ObjectStorage, dstPath string, srcStorage ObjectStorage, sr
// Clean delete all the objects in this storage
func Clean(storage ObjectStorage) error {
return storage.IterateObjects(func(path string, obj Object) error {
_ = obj.Close()
return storage.Delete(path)
})
}
Expand Down

0 comments on commit 076bb8a

Please sign in to comment.