Skip to content

Commit

Permalink
fix(routes): skip bad manifests
Browse files Browse the repository at this point in the history
  • Loading branch information
mxyng committed May 10, 2024
1 parent c02db93 commit e036371
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions server/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e036371

Please sign in to comment.