Skip to content

Commit 4cc5bcd

Browse files
committed
Close storage objects before cleaning (go-gitea#16934)
Backport go-gitea#16934 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 go-gitea#16932 Signed-off-by: Andrew Thornton <[email protected]>
1 parent 6f261fd commit 4cc5bcd

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

modules/storage/storage.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ func Copy(dstStorage ObjectStorage, dstPath string, srcStorage ObjectStorage, sr
9191
// Clean delete all the objects in this storage
9292
func Clean(storage ObjectStorage) error {
9393
return storage.IterateObjects(func(path string, obj Object) error {
94+
_ = obj.Close()
9495
return storage.Delete(path)
9596
})
9697
}

0 commit comments

Comments
 (0)