Bug
When pasting a URL that contains a bech32 ID in a query parameter (e.g. ?npub=npub1... or ?event=nevent1...), the auto-prefix logic in ComposeViewModel and DmConversationViewModel incorrectly injects nostr: inside the URL, breaking the link.
Steps to reproduce
Open New Post or a DM in Wisp
Paste: https://example.com/artist.html?npub=npub1abcdef...
Result: https://example.com/artist.html?npub=nostr:npub1abcdef...
Root cause
The BARE_BECH32_REGEX and DM_BARE_BECH32_REGEX use (?<![a-z0-9/.:#]) to avoid matching bech32 IDs embedded in URLs. This misses query-parameter characters (=, ?, &), so bech32 IDs in ?key=*** URLs are treated as bare IDs.
Fix
Add =, ?, & to the negative lookbehind character class in both regexes:
In ComposeViewModel.kt (line 58):
(?<!nostr:)(?<![a-z0-9/.:#?=&])((note1|nevent1|npub1|nprofile1|naddr1)[a-z0-9]{10,})
In DmConversationViewModel.kt (line 44):
(?<!nostr:)(?<![a-z0-9/.:#?=&])((note1|nevent1|npub1|nprofile1)[a-z0-9]{10,})
Impact
- Fixes broken share links from services like IndieSats, Primal, etc.
- Zero behavior change for legitimate bare bech32 IDs (still prefixed correctly when preceded by whitespace or start of string).
Bug
When pasting a URL that contains a bech32 ID in a query parameter (e.g. ?npub=npub1... or ?event=nevent1...), the auto-prefix logic in ComposeViewModel and DmConversationViewModel incorrectly injects
nostr:inside the URL, breaking the link.Steps to reproduce
Root cause
The BARE_BECH32_REGEX and DM_BARE_BECH32_REGEX use
(?<![a-z0-9/.:#])to avoid matching bech32 IDs embedded in URLs. This misses query-parameter characters (=, ?, &), so bech32 IDs in ?key=*** URLs are treated as bare IDs.Fix
Add =, ?, & to the negative lookbehind character class in both regexes:
In ComposeViewModel.kt (line 58):
In DmConversationViewModel.kt (line 44):
Impact