about summary refs log tree commit diff
path: root/bskyweb
diff options
context:
space:
mode:
authordevin ivy <devinivy@gmail.com>2024-10-31 17:24:56 -0400
committerGitHub <noreply@github.com>2024-10-31 14:24:56 -0700
commitd5f8d8224fd5ce18b1404ccc605136de8a9d156f (patch)
treec1e70efec2f926615c04bed20a5fa33d30e2d1c0 /bskyweb
parentaa6aad652e8091ea6039af82f41d4de3669a5944 (diff)
downloadvoidsky-d5f8d8224fd5ce18b1404ccc605136de8a9d156f.tar.zst
bskyweb: fix post text expansion (#6016)
Co-authored-by: Hailey <me@haileyok.com>
Diffstat (limited to 'bskyweb')
-rw-r--r--bskyweb/cmd/bskyweb/formating.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/bskyweb/cmd/bskyweb/formating.go b/bskyweb/cmd/bskyweb/formating.go
index edd085ce8..9eac94ef8 100644
--- a/bskyweb/cmd/bskyweb/formating.go
+++ b/bskyweb/cmd/bskyweb/formating.go
@@ -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]