Skip to content

Commit

Permalink
Merge branch 'master' of github.com:knadh/listmonk
Browse files Browse the repository at this point in the history
  • Loading branch information
knadh committed Jan 15, 2022
2 parents 04ea18c + 740373d commit 28efe27
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions cmd/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
)

var (
tagRegexpSpaces = regexp.MustCompile(`[\s]+`)
regexpSpaces = regexp.MustCompile(`[\s]+`)
)

// inArray checks if a string is present in a list of strings.
Expand All @@ -32,6 +32,8 @@ func makeFilename(fName string) string {
if name == "" {
name, _ = generateRandomString(10)
}
// replace whitespace with "-"
name = regexpSpaces.ReplaceAllString(name, "-")
return filepath.Base(name)
}

Expand All @@ -55,7 +57,7 @@ func normalizeTags(tags []string) []string {
)

for _, t := range tags {
rep := tagRegexpSpaces.ReplaceAll(bytes.TrimSpace([]byte(t)), dash)
rep := regexpSpaces.ReplaceAll(bytes.TrimSpace([]byte(t)), dash)

if len(rep) > 0 {
out = append(out, string(rep))
Expand Down

0 comments on commit 28efe27

Please sign in to comment.