mirror of
https://github.com/coracle-social/coracle.git
synced 2024-09-19 11:43:35 +00:00
If someone gives us a hex key (like nostr.band does), handle it instead of crashing
This commit is contained in:
parent
fe990f7d26
commit
20d61ed6dc
@ -130,6 +130,10 @@ export const asDisplayEvent = event =>
|
||||
({replies: [], reactions: [], zaps: [], ...event} as DisplayEvent)
|
||||
|
||||
export const toHex = (data: string): string | null => {
|
||||
if (data.match(/[a-zA-Z0-9]{64}/)) {
|
||||
return data
|
||||
}
|
||||
|
||||
try {
|
||||
return nip19.decode(data).data as string
|
||||
} catch (e) {
|
||||
|
Loading…
Reference in New Issue
Block a user