Unverified Commit 798b107f authored by Ryo Machida's avatar Ryo Machida Committed by GitHub
Browse files

Fixed the API endpoint /api/tags when the model list is empty. (#4424)



* Fixed the API endpoint /api/tags to return {models: []} instead of {models: null} when the model list is empty.

* Update server/routes.go

---------
Co-authored-by: default avatarJeffrey Morgan <jmorganca@gmail.com>
parent 6a1b4713
......@@ -725,7 +725,7 @@ func (s *Server) ListModelsHandler(c *gin.Context) {
return
}
var models []api.ModelResponse
models := []api.ModelResponse{}
if err := filepath.Walk(manifests, func(path string, info os.FileInfo, _ error) error {
if !info.IsDir() {
rel, err := filepath.Rel(manifests, path)
......
......@@ -95,6 +95,7 @@ func Test_Routes(t *testing.T) {
err = json.Unmarshal(body, &modelList)
assert.Nil(t, err)
assert.NotNil(t, modelList.Models)
assert.Equal(t, 0, len(modelList.Models))
},
},
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment