refactor(upload): move Regex to variable

This commit is contained in:
tueem committed 2026-02-09 08:19:30 +01:00
1 parent 823f5f091a
commit 6cf349bafa
2 files changed
+5 -3

No files matched your search

+3 -3
View File
@@ -27,9 +27,9 @@ func Create(svgbuf []byte) (svg.TemplateData, error) {
return data, nil
}
func populateKeys(data *svg.TemplateData, svg []byte) {
regex := regexp.MustCompile(`\{\{\s*(.*?)\s*\}\}`)
result := regex.FindAllSubmatch(svg, -1)
func populateKeys(data *svg.TemplateData, svgblob []byte) {
regex := regexp.MustCompile(svg.KeyRegex)
result := regex.FindAllSubmatch(svgblob, -1)
templateKeys := make([]string, len(result))
for i, matches := range result {
+2
View File
@@ -1,5 +1,7 @@
package svg
const KeyRegex string = `\{\{\s*(.*?)\s*\}\}`
type TemplateData struct {
Id string
TemplateKeys []string