Skip to content

High performance, self-hosted, newsletter and mailing list manager with a modern dashboard. Single binary app.

Make CSV (import) header fields agnostic of surrounding spaces. Closes #2189.

Kailash Nadh97fde644614c
diff --git a/internal/subimporter/importer.go b/internal/subimporter/importer.go
index 5a41bf1e..a9a1a2ed 100644
--- a/internal/subimporter/importer.go
+++ b/internal/subimporter/importer.go
@@ -666,7 +666,7 @@ func (s *Session) mapCSVHeaders(csvHdrs []string, knownHdrs map[string]bool) map
hdrKeys := make(map[string]int)
for i, h := range csvHdrs {
// Clean the string of non-ASCII characters (BOM etc.).
- h := regexCleanStr.ReplaceAllString(h, "")
+ h := regexCleanStr.ReplaceAllString(strings.TrimSpace(h), "")
if _, ok := knownHdrs[h]; !ok {
s.log.Printf("ignoring unknown header '%s'", h)
continue