summaryrefslogtreecommitdiffstats
path: root/modules/storage/local.go
diff options
context:
space:
mode:
authorFuXiaoHei <fuxiaohei@vip.qq.com>2023-05-14 06:33:25 +0800
committerGitHub <noreply@github.com>2023-05-13 22:33:25 +0000
commit61ad4c607b09f102151298af98757dbae2c2fa88 (patch)
tree64067be6a02eba93d947183878c0e86a927bf810 /modules/storage/local.go
parent4810fe55e3e73edb962052df46bef125eb1817b3 (diff)
downloadgitea-61ad4c607b09f102151298af98757dbae2c2fa88.tar.gz
gitea-61ad4c607b09f102151298af98757dbae2c2fa88.zip
fix minio storage iterator path (#24691)
minio storage iterator shows different behavior with local fs iterator. in local fs storage: ``` go s.IterateObjects("prefix", func(path,obj) println(path) // show "prefix/xxx.file" }) ``` in minio storage: ```go s.IterateObjects("prefix", func(path,obj) println(path) // show "xxx.file" }) ``` I think local fs is correct, minio use wrong `basePath` to trim storage path prefix. --------- Co-authored-by: Giteabot <teabot@gitea.io>
Diffstat (limited to 'modules/storage/local.go')
-rw-r--r--modules/storage/local.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/modules/storage/local.go b/modules/storage/local.go
index d22974a65a..73ef306979 100644
--- a/modules/storage/local.go
+++ b/modules/storage/local.go
@@ -133,8 +133,8 @@ func (l *LocalStorage) URL(path, name string) (*url.URL, error) {
}
// IterateObjects iterates across the objects in the local storage
-func (l *LocalStorage) IterateObjects(prefix string, fn func(path string, obj Object) error) error {
- dir := l.buildLocalPath(prefix)
+func (l *LocalStorage) IterateObjects(dirName string, fn func(path string, obj Object) error) error {
+ dir := l.buildLocalPath(dirName)
return filepath.WalkDir(dir, func(path string, d os.DirEntry, err error) error {
if err != nil {
return err