Skip to content

Commit c83b471

Browse files
committed
another bug fix
1 parent 5c27ef1 commit c83b471

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

telegram/formatting.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,15 @@ func parseHTMLToTags(htmlStr string) (string, []Tag, error) {
129129

130130
// Return the cleaned text string and tag offsets list
131131
cleanedText := strings.TrimSpace(textBuf.String())
132+
// for any tag if length is 0, remove it
133+
var newTagOffsets []Tag
134+
for _, tag := range tagOffsets {
135+
if tag.Length > 0 {
136+
newTagOffsets = append(newTagOffsets, tag)
137+
}
138+
}
139+
tagOffsets = newTagOffsets
140+
132141
return cleanedText, tagOffsets, nil
133142
}
134143

0 commit comments

Comments
 (0)