summaryrefslogtreecommitdiffstats
path: root/modules/storage/minio.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2021-09-06 22:46:20 +0800
committerGitHub <noreply@github.com>2021-09-06 16:46:20 +0200
commita807031a3093964387171a5bb07cc2c9181f0444 (patch)
tree01143ab519c89cb857c71f458be376558f9758c7 /modules/storage/minio.go
parent82da380af73cba733f15f12f12807a12f8efcc56 (diff)
downloadgitea-a807031a3093964387171a5bb07cc2c9181f0444.tar.gz
gitea-a807031a3093964387171a5bb07cc2c9181f0444.zip
Fix storage Iterate bug and Add storage doctor to delete garbage attachments (#16971)
* Fix storage Iterate bug and Add storage doctor to delete garbage attachments * Close object when used
Diffstat (limited to 'modules/storage/minio.go')
-rw-r--r--modules/storage/minio.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/modules/storage/minio.go b/modules/storage/minio.go
index 724445c0ab..f78ba6aa27 100644
--- a/modules/storage/minio.go
+++ b/modules/storage/minio.go
@@ -151,7 +151,7 @@ type minioFileInfo struct {
}
func (m minioFileInfo) Name() string {
- return m.ObjectInfo.Key
+ return path.Base(m.ObjectInfo.Key)
}
func (m minioFileInfo) Size() int64 {
@@ -219,7 +219,7 @@ func (m *MinioStorage) IterateObjects(fn func(path string, obj Object) error) er
}
if err := func(object *minio.Object, fn func(path string, obj Object) error) error {
defer object.Close()
- return fn(strings.TrimPrefix(m.basePath, mObjInfo.Key), &minioObject{object})
+ return fn(strings.TrimPrefix(mObjInfo.Key, m.basePath), &minioObject{object})
}(object, fn); err != nil {
return convertMinioErr(err)
}