Skip to content

Commit 51f2123

Browse files
authoredDec 6, 2024··
fix: handle BLOW_UNKNOWN error to download DBs (#8060)
1 parent ffe24e1 commit 51f2123

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed
 

‎pkg/oci/artifact.go

+15-2
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,19 @@ func shouldTryOtherRepo(err error) bool {
262262
}
263263
}
264264

265-
// try the following artifact only if a temporary error occurs
266-
return terr.Temporary()
265+
// try the following artifact if a temporary error occurs
266+
if terr.Temporary() {
267+
return true
268+
}
269+
270+
// `GCR` periodically returns `BLOB_UNKNOWN` error.
271+
// cf. https://github.com/aquasecurity/trivy/discussions/8020
272+
// In this case we need to check other repositories.
273+
for _, e := range terr.Errors {
274+
if e.Code == transport.BlobUnknownErrorCode {
275+
return true
276+
}
277+
}
278+
279+
return false
267280
}

0 commit comments

Comments
 (0)
Please sign in to comment.