mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Add missing bounds in ContinueOnError
ContinueOnError assumes that something of type errcode.Errors contains at least one error. This is generally true, but might not be true if the remote registry returns an empty error body or invalid JSON. Add the bounds check, and in the case where it fails, allow fallbacks to v1. Fixes #18481 Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
This commit is contained in:
parent
5f1af8da5b
commit
1ebfa29954
1 changed files with 3 additions and 0 deletions
|
@ -213,6 +213,9 @@ func (e ErrNoSupport) Error() string {
|
|||
func ContinueOnError(err error) bool {
|
||||
switch v := err.(type) {
|
||||
case errcode.Errors:
|
||||
if len(v) == 0 {
|
||||
return true
|
||||
}
|
||||
return ContinueOnError(v[0])
|
||||
case ErrNoSupport:
|
||||
return ContinueOnError(v.Err)
|
||||
|
|
Loading…
Add table
Reference in a new issue