From 30ff0a4b2763b3b0adf12a3811a955810c3ccb56 Mon Sep 17 00:00:00 2001 From: mountain Date: Thu, 22 Jun 2023 20:24:59 +0900 Subject: [PATCH] =?UTF-8?q?deploy=20source=EC=97=90=20=EB=8B=A4=EC=9A=B4?= =?UTF-8?q?=EB=A1=9C=EB=93=9C=20=EA=B2=BD=EB=A1=9C=EB=A5=BC=20=EB=B3=B4?= =?UTF-8?q?=EB=82=B4=EC=A4=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/http_api.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) 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