nostr-rs-relay
nostr-rs-relay copied to clipboard
NIP-33 Bug on querying identifier tag (postgresql)
I was querying a specific replaceable parametrized event that contains a #d tag with an identifier that contains an even amount of characters. This caused the hex code check to be completely ignored and assumed to be a hex code.
Here is the code that causes the error: https://github.com/scsibug/nostr-rs-relay/blob/4adad4c3a99c1454952e46478d42c838e2730e6f/src/repo/postgres.rs#L889
This seems to fix it:
if v.len() % 2 == 0 && is_lower_hex(v) {
tag_query.push_bind(hex::decode(v).ok());
} else {
tag_query.push_bind(v.as_bytes());
}
I don't know much about Rust, which is why I didn't do a PR.
It should be fixed by https://github.com/scsibug/nostr-rs-relay/pull/164
I will test it during the week. Thank you.