fix(routes): skip bad manifests
This commit is contained in:
parent
c02db93243
commit
e03637176d
1 changed files with 7 additions and 4 deletions
|
@ -735,24 +735,27 @@ func (s *Server) ListModelsHandler(c *gin.Context) {
|
||||||
|
|
||||||
n := model.ParseNameFromFilepath(rel)
|
n := model.ParseNameFromFilepath(rel)
|
||||||
if !n.IsValid() {
|
if !n.IsValid() {
|
||||||
slog.Info("invalid model filepath", "path", rel)
|
slog.Warn("bad manifest filepath", "path", rel)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
m, err := ParseNamedManifest(n)
|
m, err := ParseNamedManifest(n)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
slog.Warn("bad manifest", "name", n, "error", err)
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
f, err := m.Config.Open()
|
f, err := m.Config.Open()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
slog.Warn("bad manifest config filepath", "name", n, "error", err)
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
defer f.Close()
|
defer f.Close()
|
||||||
|
|
||||||
var c ConfigV2
|
var c ConfigV2
|
||||||
if err := json.NewDecoder(f).Decode(&c); err != nil {
|
if err := json.NewDecoder(f).Decode(&c); err != nil {
|
||||||
return err
|
slog.Warn("bad manifest config", "name", n, "error", err)
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// tag should never be masked
|
// tag should never be masked
|
||||||
|
|
Loading…
Reference in a new issue