mirror of
https://github.com/nbd-wtf/go-nostr.git
synced 2025-08-24 04:30:38 +02:00
nip27: fix for contents that end in broken strings.
This commit is contained in:
@@ -78,7 +78,7 @@ func Parse(content string) iter.Seq[Block] {
|
|||||||
index = end
|
index = end
|
||||||
prevIndex = index
|
prevIndex = index
|
||||||
continue
|
continue
|
||||||
case (u >= 5 && content[u-5:u] == "https") || (u >= 4 && content[u-4:u] == "http"):
|
case ((u >= 5 && content[u-5:u] == "https") || (u >= 4 && content[u-4:u] == "http")) && u+4 < max:
|
||||||
m := noURLCharacter.FindStringIndex(content[u+4:])
|
m := noURLCharacter.FindStringIndex(content[u+4:])
|
||||||
end := max
|
end := max
|
||||||
if m != nil {
|
if m != nil {
|
||||||
@@ -108,7 +108,7 @@ func Parse(content string) iter.Seq[Block] {
|
|||||||
index = end
|
index = end
|
||||||
prevIndex = index
|
prevIndex = index
|
||||||
continue
|
continue
|
||||||
case (u >= 3 && content[u-3:u] == "wss") || (u >= 2 && content[u-2:u] == "ws"):
|
case ((u >= 3 && content[u-3:u] == "wss") || (u >= 2 && content[u-2:u] == "ws")) && u+4 < max:
|
||||||
m := noURLCharacter.FindStringIndex(content[u+4:])
|
m := noURLCharacter.FindStringIndex(content[u+4:])
|
||||||
end := max
|
end := max
|
||||||
if m != nil {
|
if m != nil {
|
||||||
|
Reference in New Issue
Block a user