From c4b5eb219aedb86b6262ee5c8df60c3f3ecf0a50 Mon Sep 17 00:00:00 2001 From: Matias Pan Date: Thu, 7 Mar 2024 17:13:51 -0300 Subject: [PATCH] Add name slugs that are URL safe Signed-off-by: Matias Pan --- main.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/main.go b/main.go index b4ed57a..dec45e0 100644 --- a/main.go +++ b/main.go @@ -125,9 +125,10 @@ func generatorHandler(l zerolog.Logger) http.HandlerFunc { } type Release struct { - Name string `json:"name"` - Commit Commit `json:"commit"` - NodeID string `json:"node_id"` + Name string `json:"name"` + NameSlug string `json:"name_slug"` + Commit Commit `json:"commit"` + NodeID string `json:"node_id"` } type Commit struct { @@ -139,6 +140,7 @@ func getFilteredReleases(releases []Release, minRelease string) []Release { var filteredReleases []Release for _, r := range releases { if semver.Compare(r.Name, minRelease) > 0 { + r.NameSlug = strings.ReplaceAll(r.Name, ".", "-") filteredReleases = append(filteredReleases, r) } }