Merge pull request #4295 from ollama/mxyng/fix-list

routes: skip invalid filepaths
This commit is contained in:
Michael Yang 2024-05-09 11:37:34 -07:00 committed by GitHub
commit 1580ed4c06
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -732,6 +732,11 @@ func (s *Server) ListModelsHandler(c *gin.Context) {
}
n := model.ParseNameFromFilepath(rel)
if !n.IsValid() {
slog.Info("invalid model filepath", "path", rel)
return nil
}
m, err := ParseNamedManifest(n)
if err != nil {
return err