Tolerate whitespace in pasted event ID lookups

The Load Event field requires 64 contiguous hex chars, but the event ID
printed on a tear-off tab wraps across two lines, so copying it back in
pastes as two 32-char halves separated by a newline/space and failed to
match. Strip inner whitespace before matching the raw hex id, which also
tolerates a pasted "Event ID:" label prefix. naddr/note/nevent inputs are
unaffected.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
thePR0M3TH3ANandClaude Opus 4.8 committed 2026-06-09 10:37:07 -04:00
1 parent aedb381dfb
commit 828ac3a624
1 file changed
+5 -1
+5 -1
View File
@@ -1581,7 +1581,11 @@ Join us in a revolution that values truth and transparency. Together, we can bui
if (!raw) return null;
try {
const decoded = decodeURIComponent(raw);
const rawId = decoded.match(/\b[a-f0-9]{64}\b/i);
// A 64-char hex event id is often copied with whitespace or a line break
// in the middle (e.g. the two-line event ID printed on a tear-off tab, or
// a label like "Event ID: ..."), so match against the input with inner
// whitespace removed.
const rawId = decoded.replace(/\s+/g, "").match(/\b[a-f0-9]{64}\b/i);
if (rawId) return { type: "event", id: rawId[0].toLowerCase(), relays: [] };
const nipMatch = decoded.match(/(?:nostr:)?((?:note1|nevent1|naddr1)[023456789acdefghjklmnpqrstuvwxyz]+)/i);
if (!nipMatch) return null;