Fix tags with values containing =

This commit is contained in:
Daniel Cadenas
2023-12-13 19:31:52 -03:00
committed by fiatjaf_
parent 242b028656
commit f35cb4bd1d
2 changed files with 7 additions and 7 deletions

View File

@@ -153,12 +153,12 @@ example:
tags := make(nostr.Tags, 0, 5)
for _, tagFlag := range c.StringSlice("tag") {
// tags are in the format key=value
spl := strings.Split(tagFlag, "=")
if len(spl) == 2 && len(spl[0]) > 0 {
tag := nostr.Tag{spl[0]}
tagName, tagValue, found := strings.Cut(tagFlag, "=")
tag := []string{tagName}
if found {
// tags may also contain extra elements separated with a ";"
spl2 := strings.Split(spl[1], ";")
tag = append(tag, spl2...)
tagValues := strings.Split(tagValue, ";")
tag = append(tag, tagValues...)
// ~
tags = append(tags, tag)
}