forked from Gitlink/gitea-1156
Backport #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 #16932 Signed-off-by: Andrew Thornton <art27@cantab.net>
This commit is contained in:
parent
6f261fdf47
commit
5cb5101720
|
@ -91,6 +91,7 @@ func Copy(dstStorage ObjectStorage, dstPath string, srcStorage ObjectStorage, sr
|
||||||
// Clean delete all the objects in this storage
|
// Clean delete all the objects in this storage
|
||||||
func Clean(storage ObjectStorage) error {
|
func Clean(storage ObjectStorage) error {
|
||||||
return storage.IterateObjects(func(path string, obj Object) error {
|
return storage.IterateObjects(func(path string, obj Object) error {
|
||||||
|
_ = obj.Close()
|
||||||
return storage.Delete(path)
|
return storage.Delete(path)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue