strfry icon indicating copy to clipboard operation
strfry copied to clipboard

Allow tags with empty string value

Open heguro opened this issue 2 years ago • 1 comments

Currently strfry rejects event with tag having empty string value (e.g. ["d", ""]) by this line:

https://github.com/hoytech/strfry/blob/e5ec135e78170756f5fd83a2cf4e25d611efd1ce/src/events.cpp#L47

But:

  • NIP-33 has example of empty d tags.
  • Some events with empty tags have already been published. You can see NIP-23 posts (kind:30023) and NIP-58 badges (kind:30009) having tags like ["d", ""], ["thumb", ""] at wss://nostr-pub.wellorder.net.
    • Send ["REQ", "subId", { "#d": [""] }] with Nostr Playground to see some cases.

EDIT: If this is allowed, it would be even better if it could also be searched by query { "#d": [""] } which is currently rejected by error "filter item too small".

heguro avatar Mar 09 '23 05:03 heguro

Hi, thank you for reporting this!

I noticed this issue too, and actually fixed it in this commit:

https://github.com/hoytech/strfry/commit/7d5aebbf43b0ec4c0e50499042944b0918b3a2be

I haven't merged it yet because it's tied in with changes I made for https://github.com/nostr-protocol/nips/issues/236 , which has been rejected.

I will try to break up this commit and merge the relevant fixes into master ASAP.

Good idea on querying empty tags -- I actually added that to the TODO file in the same commit! There is an internal technical detail that makes this slightly complicated, but I will fix it eventually.

hoytech avatar Mar 09 '23 16:03 hoytech