mirror of
https://github.com/aljazceru/njump.git
synced 2026-02-10 08:34:24 +01:00
fix enhanced event "a" tag parsing.
This commit is contained in:
@@ -76,21 +76,28 @@ func (ee EnhancedEvent) getParentNevent() string {
|
||||
if (len(*replyTag) > 2) && ((*replyTag)[2] != "") {
|
||||
relays = []string{(*replyTag)[2]}
|
||||
}
|
||||
eventId := (*replyTag)[1]
|
||||
if (*replyTag)[0] == "a" { // Reply to a ndaddr event
|
||||
eventId = strings.Split(eventId, ":")[1]
|
||||
kind, _ := strconv.Atoi(strings.Split((*replyTag)[1], ":")[0])
|
||||
identifier := strings.Split((*replyTag)[1], ":")[2]
|
||||
if (*replyTag)[0] == "a" { // reply to a ndaddr event
|
||||
spl := strings.Split((*replyTag)[1], ":")
|
||||
if len(spl) != 3 {
|
||||
return ""
|
||||
}
|
||||
author := spl[1]
|
||||
kind, _ := strconv.Atoi(spl[0])
|
||||
identifier := spl[2]
|
||||
|
||||
var relays []string
|
||||
if (len(*replyTag) > 2) && ((*replyTag)[2] != "") {
|
||||
relays = []string{(*replyTag)[2]}
|
||||
}
|
||||
|
||||
parentNevent, _ = nip19.EncodeEntity(
|
||||
eventId,
|
||||
author,
|
||||
kind,
|
||||
identifier,
|
||||
relays)
|
||||
relays,
|
||||
)
|
||||
} else {
|
||||
eventId := (*replyTag)[1]
|
||||
parentNevent, _ = nip19.EncodeEvent(eventId, relays, "")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user