Skip to content

Commit 59c0101

Browse files
authored
Merge pull request #33 from infosiftr/401
Also treat 401 as if it were 404
2 parents cf871c9 + 1c19f8f commit 59c0101

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

registry/synthesize-index.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ func SynthesizeIndex(ctx context.Context, ref ociref.Reference) (*ocispec.Index,
3737
if errors.Is(err, ociregistry.ErrBlobUnknown) ||
3838
errors.Is(err, ociregistry.ErrManifestUnknown) ||
3939
errors.Is(err, ociregistry.ErrNameUnknown) ||
40-
strings.HasPrefix(err.Error(), "404 ") {
40+
strings.HasPrefix(err.Error(), "404 ") ||
41+
// 401 often means "repository not found" (due to the nature of public/private mixing on Hub and the fact that ociauth definitely handled any possible authentication for us, so if we're still getting 401 it's unavoidable and might as well be 404)
42+
strings.HasPrefix(err.Error(), "401 ") {
4143
return nil, nil
4244
}
4345
return nil, fmt.Errorf("%s: failed GET: %w", ref, err)

0 commit comments

Comments
 (0)