fix(routes): skip bad manifests

This commit is contained in:
Michael Yang 2024-05-09 17:44:34 -07:00
parent c02db93243
commit e03637176d

View file

@ -735,24 +735,27 @@ func (s *Server) ListModelsHandler(c *gin.Context) {
n := model.ParseNameFromFilepath(rel)
if !n.IsValid() {
slog.Info("invalid model filepath", "path", rel)
slog.Warn("bad manifest filepath", "path", rel)
return nil
}
m, err := ParseNamedManifest(n)
if err != nil {
return err
slog.Warn("bad manifest", "name", n, "error", err)
return nil
}
f, err := m.Config.Open()
if err != nil {
return err
slog.Warn("bad manifest config filepath", "name", n, "error", err)
return nil
}
defer f.Close()
var c ConfigV2
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