Update typeurl to v2.2.2

Fixes panic when typeurl is not found

Signed-off-by: Derek McGowan <derek@mcg.dev>
This commit is contained in:
Derek McGowan
2024-11-04 22:29:24 -08:00
parent 18caa33fdc
commit ff09b428e1
4 changed files with 10 additions and 12 deletions

View File

@@ -284,16 +284,14 @@ func getTypeByUrl(url string) (reflect.Type, error) {
mu.RUnlock()
mt, err := protoregistry.GlobalTypes.FindMessageByURL(url)
if err != nil {
e := protoregistry.NotFound
if !errors.Is(err, e) {
return nil, fmt.Errorf("type with url %s: %w", url, ErrNotFound)
}
for _, h := range handlers {
if t := h.GetType(url); t != nil {
return t, nil
if errors.Is(err, protoregistry.NotFound) {
for _, h := range handlers {
if t := h.GetType(url); t != nil {
return t, nil
}
}
}
return nil, fmt.Errorf("type with url %s: %w", url, ErrNotFound)
}
empty := mt.New().Interface()
return reflect.TypeOf(empty).Elem(), nil

2
vendor/modules.txt vendored
View File

@@ -194,7 +194,7 @@ github.com/containerd/plugin/registry
# github.com/containerd/ttrpc v1.2.6
## explicit; go 1.19
github.com/containerd/ttrpc
# github.com/containerd/typeurl/v2 v2.2.1
# github.com/containerd/typeurl/v2 v2.2.2
## explicit; go 1.21
github.com/containerd/typeurl/v2
# github.com/containerd/zfs/v2 v2.0.0-rc.0