nip54: trim spaces.

This commit is contained in:
fiatjaf 2024-03-13 19:26:37 -03:00
parent 6f32e4da63
commit 01d5dc02c5
2 changed files with 2 additions and 2 deletions

View File

@ -9,7 +9,7 @@ import (
)
func NormalizeIdentifier(name string) string {
name = strings.ToLower(name)
name = strings.TrimSpace(strings.ToLower(name))
res, _, _ := transform.Bytes(norm.NFKC, []byte(name))
runes := []rune(string(res))

View File

@ -10,7 +10,7 @@ func TestNormalization(t *testing.T) {
before string
after string
}{
{"hello", "hello"},
{" hello ", "hello"},
{"Goodbye", "goodbye"},
{"the long and winding road / that leads to your door", "the-long-and-winding-road---that-leads-to-your-door"},
{"it's 平仮名", "it-s-平仮名"},