summaryrefslogtreecommitdiffstats
path: root/modules/storage/storage.go
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2021-09-03 11:48:49 +0100
committerGitHub <noreply@github.com>2021-09-03 11:48:49 +0100
commit076bb8a2a2e666ad0ee4bc18a31f3913ff7bffb3 (patch)
tree57bec94f19e74a329111f99ab4fb7ca3c8cdb449 /modules/storage/storage.go
parent6c125e979713259f41e99ef738a612318c69fbc5 (diff)
downloadgitea-076bb8a2a2e666ad0ee4bc18a31f3913ff7bffb3.tar.gz
gitea-076bb8a2a2e666ad0ee4bc18a31f3913ff7bffb3.zip
Close storage objects before cleaning (#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>
Diffstat (limited to 'modules/storage/storage.go')
-rw-r--r--modules/storage/storage.go1
1 files changed, 1 insertions, 0 deletions
diff --git a/modules/storage/storage.go b/modules/storage/storage.go
index 9f87e58b60..2532ceb35d 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)
})
}