fix: catch some errors
This commit is contained in:
parent
4994b26520
commit
2f9be97178
2 changed files with 26 additions and 14 deletions
|
|
@ -333,11 +333,15 @@ export function extractEmbeddedEventIds(event: Event) {
|
|||
const embeddedEventIds: string[] = []
|
||||
const embeddedNoteRegex = /nostr:(note1[a-z0-9]{58}|nevent1[a-z0-9]+)/g
|
||||
;(event.content.match(embeddedNoteRegex) || []).forEach((note) => {
|
||||
const { type, data } = nip19.decode(note.split(':')[1])
|
||||
if (type === 'nevent') {
|
||||
embeddedEventIds.push(data.id)
|
||||
} else if (type === 'note') {
|
||||
embeddedEventIds.push(data)
|
||||
try {
|
||||
const { type, data } = nip19.decode(note.split(':')[1])
|
||||
if (type === 'nevent') {
|
||||
embeddedEventIds.push(data.id)
|
||||
} else if (type === 'note') {
|
||||
embeddedEventIds.push(data)
|
||||
}
|
||||
} catch {
|
||||
// ignore
|
||||
}
|
||||
})
|
||||
EVENT_EMBEDDED_EVENT_IDS_CACHE.set(event.id, embeddedEventIds)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue