Handle special characters in event names

This commit is contained in:
2023-06-10 08:24:17 +00:00
parent b98fc73ea1
commit 823c7e8bf7
2 changed files with 36 additions and 0 deletions

View File

@@ -22,6 +22,10 @@ func GenerateEventChannelName(eventName string, location string, dateTime time.T
city := GetCityFromLocation(location)
year := dateTime.Year()
// Remove special characters
eventName = regexp.MustCompile(`[^a-zA-Z0-9 ]+`).ReplaceAllString(eventName, "")
eventName = strings.Trim(eventName, " ")
channel := fmt.Sprint(month, "-", day, city, "-", eventName, "-", year)
channel = strings.ReplaceAll(channel, " ", "-")
channel = strings.ToLower(channel)