add path prefix to ObjectStorage.Iterator (#23332)
Support to iterator subdirectory in ObjectStorage for ObjectStorage.Iterator method. It's required for https://github.com/go-gitea/gitea/pull/22738 to make artifact files cleanable. --------- Co-authored-by: Jason Song <i@wolfogre.com> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
parent
757b4c17e9
commit
cdc9e91750
9 changed files with 67 additions and 15 deletions
|
@ -201,7 +201,7 @@ func PrepareTestEnv(t testing.TB, skip ...int) func() {
|
|||
lfsFixtures, err := storage.NewStorage("", storage.LocalStorageConfig{Path: path.Join(filepath.Dir(setting.AppPath), "tests/gitea-lfs-meta")})
|
||||
assert.NoError(t, err)
|
||||
assert.NoError(t, storage.Clean(storage.LFS))
|
||||
assert.NoError(t, lfsFixtures.IterateObjects(func(path string, _ storage.Object) error {
|
||||
assert.NoError(t, lfsFixtures.IterateObjects("", func(path string, _ storage.Object) error {
|
||||
_, err := storage.Copy(storage.LFS, path, lfsFixtures, path)
|
||||
return err
|
||||
}))
|
||||
|
@ -258,7 +258,7 @@ func ResetFixtures(t *testing.T) {
|
|||
lfsFixtures, err := storage.NewStorage("", storage.LocalStorageConfig{Path: path.Join(filepath.Dir(setting.AppPath), "tests/gitea-lfs-meta")})
|
||||
assert.NoError(t, err)
|
||||
assert.NoError(t, storage.Clean(storage.LFS))
|
||||
assert.NoError(t, lfsFixtures.IterateObjects(func(path string, _ storage.Object) error {
|
||||
assert.NoError(t, lfsFixtures.IterateObjects("", func(path string, _ storage.Object) error {
|
||||
_, err := storage.Copy(storage.LFS, path, lfsFixtures, path)
|
||||
return err
|
||||
}))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue