diff --git a/server/http_api.go b/server/http_api.go index c49d18a..917cb5c 100644 --- a/server/http_api.go +++ b/server/http_api.go @@ -3,6 +3,7 @@ package server import ( "encoding/json" "errors" + "fmt" "io" "io/fs" "net/http" @@ -41,10 +42,16 @@ func (h *houstonHandler) GetDeploySources(w http.ResponseWriter, r *http.Request getVersions := func(name string) []string { var out []string - files, _ := os.ReadDir(path.Join(h.deployPath, name)) - for _, fd := range files { + vers, _ := os.ReadDir(path.Join(h.deployPath, name)) + for _, fd := range vers { if fd.IsDir() { - out = append(out, fd.Name()) + ver := fd.Name() + files, _ := os.ReadDir(path.Join(h.deployPath, name, ver)) + if len(files) > 0 { + downloadpath := path.Join(h.deployPath, name, ver, files[0].Name()) + ver = fmt.Sprintf("%s:%s", ver, downloadpath) + } + out = append(out, ver) } } return out