fix(services): keep original step Slugify; org reuses it

This commit is contained in:
2026-07-21 16:33:31 +01:00
parent 01fd2e201e
commit 404214d82e
2 changed files with 9 additions and 14 deletions
-14
View File
@@ -3,8 +3,6 @@ package services
import (
"context"
"fmt"
"regexp"
"strings"
"time"
"github.com/google/uuid"
@@ -19,18 +17,6 @@ var reservedSlugs = map[string]bool{
"install": true, "static": true, "_next": true, "default": true,
}
var slugStrip = regexp.MustCompile(`[^a-z0-9-]+`)
var slugDashes = regexp.MustCompile(`-+`)
func Slugify(name string) string {
s := strings.ToLower(strings.TrimSpace(name))
s = strings.ReplaceAll(s, "_", "-")
s = strings.ReplaceAll(s, " ", "-")
s = slugStrip.ReplaceAllString(s, "")
s = slugDashes.ReplaceAllString(s, "-")
return strings.Trim(s, "-")
}
func GetOrg(orgID string) (*models.Org, error) {
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
+9
View File
@@ -33,3 +33,12 @@ func DeriveOutputs(script string) []string {
}
return out
}
var slugStrip = regexp.MustCompile(`[^a-z0-9]+`)
// Slugify converts a step name into a stable kebab-case slug.
func Slugify(name string) string {
s := strings.ToLower(name)
s = slugStrip.ReplaceAllString(s, "-")
return strings.Trim(s, "-")
}