다운로드 링크 수정

This commit is contained in:
2023-05-23 11:11:09 +09:00
parent 38bc72b684
commit d1efb92f52

View File

@ -10,7 +10,6 @@ import (
"time"
"repositories.action2quare.com/ayo/go-ayo/logger"
"repositories.action2quare.com/ayo/houston/shared"
)
@ -270,7 +269,12 @@ func (h *houstonHandler) GetLogFileLinks(w http.ResponseWriter, r *http.Request)
return
}
logfiles, err := os.ReadDir(path.Join("downloads", name, version))
if version == "latest" {
version, _ = shared.FindLastestVersion(path.Join("downloads", name))
}
root := path.Join("downloads", name, version)
logfiles, err := os.ReadDir(root)
if err != nil {
w.WriteHeader(http.StatusInternalServerError)
return
@ -278,7 +282,7 @@ func (h *houstonHandler) GetLogFileLinks(w http.ResponseWriter, r *http.Request)
var out []string
for _, lf := range logfiles {
out = append(out, lf.Name())
out = append(out, path.Join(root, lf.Name()))
}
enc := json.NewEncoder(w)