diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2026-01-08 14:27:50 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2026-01-08 14:27:50 +0000 |
| commit | 92bfbd3f67622bbbc77c3cd0dec78f5a5015742b (patch) | |
| tree | c7f9df813ed35d636034b3e13db868d690663788 | |
| parent | 544d5942442ae3eb94ce72e93d99a00f3e169930 (diff) | |
fix: filter out malformed announcements generated by gittr
| -rw-r--r-- | src/nostr/events.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/nostr/events.rs b/src/nostr/events.rs index 4f7c907..66808cc 100644 --- a/src/nostr/events.rs +++ b/src/nostr/events.rs | |||
| @@ -76,6 +76,17 @@ impl RepositoryAnnouncement { | |||
| 76 | }) | 76 | }) |
| 77 | .collect(); | 77 | .collect(); |
| 78 | 78 | ||
| 79 | // return error if mutliple clone tags (incorrect formatting) | ||
| 80 | let clone_tag_count = event | ||
| 81 | .tags | ||
| 82 | .iter() | ||
| 83 | .filter(|t| matches!(t.kind(), TagKind::Clone)) | ||
| 84 | .count(); | ||
| 85 | |||
| 86 | if clone_tag_count > 1 { | ||
| 87 | return Err(anyhow::anyhow!("multiple clone tags found. correct format is single clone tag with multiple values")); | ||
| 88 | } | ||
| 89 | |||
| 79 | // Extract relays | 90 | // Extract relays |
| 80 | let relays = event | 91 | let relays = event |
| 81 | .tags | 92 | .tags |