From 5cb5101720838bced7c752ee11148614a6afe498 Mon Sep 17 00:00:00 2001 From: zeripath Date: Fri, 3 Sep 2021 12:17:07 +0100 Subject: [PATCH] Close storage objects before cleaning (#16934) (#16942) 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 --- modules/storage/storage.go | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/storage/storage.go b/modules/storage/storage.go index 9f87e58b60d4..2532ceb35da1 100644 --- a/modules/storage/storage.go +++ b/modules/storage/storage.go @@ -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) }) }