Skip to content

Commit

Permalink
bskyweb: fix post text expansion (#6016)
Browse files Browse the repository at this point in the history
Co-authored-by: Hailey <[email protected]>
  • Loading branch information
devinivy and haileyok authored Oct 31, 2024
1 parent aa6aad6 commit d5f8d82
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion bskyweb/cmd/bskyweb/formating.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ func ExpandPostText(post *appbsky.FeedPost) string {
}

// bail out if bounds checks fail
if int(facet.Index.ByteStart)+charsAdded > len(postText) || int(facet.Index.ByteEnd)+charsAdded > len(postText) {
if facet.Index.ByteStart > facet.Index.ByteEnd ||
int(facet.Index.ByteStart)+charsAdded > len(postText) ||
int(facet.Index.ByteEnd)+charsAdded > len(postText) {
return false
}
linkText := postText[int(facet.Index.ByteStart)+charsAdded : int(facet.Index.ByteEnd)+charsAdded]
Expand Down

0 comments on commit d5f8d82

Please sign in to comment.