Skip to content

Commit

Permalink
Strip whitespace from Standard Forms version str
Browse files Browse the repository at this point in the history
Version 1.1.6.0 was released as `1.1.6\t.0`.
  • Loading branch information
martinhpedersen committed Jan 12, 2025
1 parent cf8d587 commit 32448b1
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion internal/forms/forms.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"strings"
"sync"
"time"
"unicode"
"unicode/utf8"

"github.com/la5nta/wl2k-go/fbb"
Expand Down Expand Up @@ -574,7 +575,15 @@ func (m *Manager) getFormsVersion() string {
debug.Printf("failed to open version file: %v", err)
return "unknown"
}
return strings.TrimSpace(str)
// Drop any whitespace in the string
// (version 1.1.6.0 was released as `1.1.6\t.0`).
str = strings.Map(func(r rune) rune {
if unicode.IsSpace(r) {
return -1
}
return r
}, str)
return str
}

func (m *Manager) cleanupOldFormData() {
Expand Down

0 comments on commit 32448b1

Please sign in to comment.