Stop ErrFinishedWalk from escaping from Repositories walk
Signed-off-by: Edgar Lee <edgar.lee@docker.com>
This commit is contained in:
parent
45b84c9512
commit
12acdf0a6c
2 changed files with 5 additions and 2 deletions
|
@ -9,7 +9,6 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/docker/distribution/registry/api/errcode"
|
"github.com/docker/distribution/registry/api/errcode"
|
||||||
"github.com/docker/distribution/registry/storage"
|
|
||||||
"github.com/docker/distribution/registry/storage/driver"
|
"github.com/docker/distribution/registry/storage/driver"
|
||||||
"github.com/gorilla/handlers"
|
"github.com/gorilla/handlers"
|
||||||
)
|
)
|
||||||
|
@ -51,7 +50,7 @@ func (ch *catalogHandler) GetCatalog(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
if err == io.EOF || pathNotFound {
|
if err == io.EOF || pathNotFound {
|
||||||
moreEntries = false
|
moreEntries = false
|
||||||
} else if err != nil && err != storage.ErrFinishedWalk {
|
} else if err != nil {
|
||||||
ch.Errors = append(ch.Errors, errcode.ErrorCodeUnknown.WithDetail(err))
|
ch.Errors = append(ch.Errors, errcode.ErrorCodeUnknown.WithDetail(err))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,10 @@ func (reg *registry) Repositories(ctx context.Context, repos []string, last stri
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// errFinishedWalk signals an early exit to the walk when the current query
|
||||||
|
// is satisfied.
|
||||||
|
errFinishedWalk := errors.New("finished walk")
|
||||||
|
|
||||||
err = Walk(ctx, reg.blobStore.driver, root, func(fileInfo driver.FileInfo) error {
|
err = Walk(ctx, reg.blobStore.driver, root, func(fileInfo driver.FileInfo) error {
|
||||||
err := handleRepository(fileInfo, root, last, func(repoPath string) error {
|
err := handleRepository(fileInfo, root, last, func(repoPath string) error {
|
||||||
foundRepos = append(foundRepos, repoPath)
|
foundRepos = append(foundRepos, repoPath)
|
||||||
|
|
Loading…
Reference in a new issue