From 6949c9119f0ed74f60e9f713f397b9729e8b1893 Mon Sep 17 00:00:00 2001 From: Andrew Thornton Date: Thu, 2 Sep 2021 21:27:50 +0100 Subject: [PATCH] Close storage objects before cleaning 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 9f87e58b60d44..2532ceb35da19 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) }) }