From a190a5e8fb2f762d3ed70b371f0f40c8e5c7b0ae Mon Sep 17 00:00:00 2001 From: William Casarin Date: Thu, 9 May 2024 13:49:06 -0700 Subject: [PATCH] nip10: handle invalid reply-with-no-root I noticed a few clients do this even though its not valid. Let's handle it. Signed-off-by: William Casarin --- damus/NIP10/ThreadReply.swift | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/damus/NIP10/ThreadReply.swift b/damus/NIP10/ThreadReply.swift index 46f04f46..ffc61c7e 100644 --- a/damus/NIP10/ThreadReply.swift +++ b/damus/NIP10/ThreadReply.swift @@ -48,6 +48,11 @@ struct ThreadReply { } } + // reply with no root should be considered reply-to-root + if root == nil && reply != nil { + root = reply + } + // nip10 threads must have a root guard let root else { return nil