Avoids parsing bad NIP-28 objects

This commit is contained in:
Vitor Pamplona
2025-08-21 17:19:22 -04:00
parent 693a75b9ec
commit 499316687f
2 changed files with 2 additions and 2 deletions

View File

@@ -60,7 +60,7 @@ class ChannelCreateEvent(
val newInfo =
try {
if (isEncrypted()) {
if (content.isEmpty() || !content.startsWith("{") || isEncrypted()) {
ChannelDataNorm()
} else {
ChannelData.parse(content)?.normalize() ?: ChannelDataNorm()

View File

@@ -66,7 +66,7 @@ class ChannelMetadataEvent(
val newInfo =
try {
if (isEncrypted()) {
if (content.isEmpty() || !content.startsWith("{") || isEncrypted()) {
ChannelDataNorm()
} else {
ChannelData.parse(content)?.normalize() ?: ChannelDataNorm()