forked from TrueCloudLab/distribution
Merge pull request #1547 from jzwlqx/issue1535
fix manifest revision search, closes #1535
This commit is contained in:
commit
96c57c4725
1 changed files with 6 additions and 5 deletions
|
@ -384,8 +384,8 @@ var _ distribution.BlobDescriptorService = &linkedBlobStatter{}
|
||||||
|
|
||||||
func (lbs *linkedBlobStatter) Stat(ctx context.Context, dgst digest.Digest) (distribution.Descriptor, error) {
|
func (lbs *linkedBlobStatter) Stat(ctx context.Context, dgst digest.Digest) (distribution.Descriptor, error) {
|
||||||
var (
|
var (
|
||||||
resolveErr error
|
found bool
|
||||||
target digest.Digest
|
target digest.Digest
|
||||||
)
|
)
|
||||||
|
|
||||||
// try the many link path functions until we get success or an error that
|
// try the many link path functions until we get success or an error that
|
||||||
|
@ -395,19 +395,20 @@ func (lbs *linkedBlobStatter) Stat(ctx context.Context, dgst digest.Digest) (dis
|
||||||
target, err = lbs.resolveWithLinkFunc(ctx, dgst, linkPathFn)
|
target, err = lbs.resolveWithLinkFunc(ctx, dgst, linkPathFn)
|
||||||
|
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
found = true
|
||||||
break // success!
|
break // success!
|
||||||
}
|
}
|
||||||
|
|
||||||
switch err := err.(type) {
|
switch err := err.(type) {
|
||||||
case driver.PathNotFoundError:
|
case driver.PathNotFoundError:
|
||||||
resolveErr = distribution.ErrBlobUnknown // move to the next linkPathFn, saving the error
|
// do nothing, just move to the next linkPathFn
|
||||||
default:
|
default:
|
||||||
return distribution.Descriptor{}, err
|
return distribution.Descriptor{}, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if resolveErr != nil {
|
if !found {
|
||||||
return distribution.Descriptor{}, resolveErr
|
return distribution.Descriptor{}, distribution.ErrBlobUnknown
|
||||||
}
|
}
|
||||||
|
|
||||||
if target != dgst {
|
if target != dgst {
|
||||||
|
|
Loading…
Reference in a new issue