Skip to content

Commit c09a8d8

Browse files
committed
Attempt to fix occasional cursor error
1 parent aa2fed1 commit c09a8d8

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

src/apiutils.nim

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,15 @@ proc genParams*(pars: openarray[(string, string)] = @[]; cursor="";
1414
result &= p
1515
if ext:
1616
result &= ("ext", "mediaStats")
17-
if cursor.len > 0:
18-
result &= ("cursor", cursor)
1917
if count.len > 0:
2018
result &= ("count", count)
19+
if cursor.len > 0:
20+
# The raw cursor often has plus signs, which sometimes get turned into spaces,
21+
# so we need to them back into a plus
22+
if " " in cursor:
23+
result &= ("cursor", cursor.replace(" ", "+"))
24+
else:
25+
result &= ("cursor", cursor)
2126

2227
proc genHeaders*(token: Token = nil): HttpHeaders =
2328
result = newHttpHeaders({

src/views/status.nim

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# SPDX-License-Identifier: AGPL-3.0-only
2-
import uri
32
import karax/[karaxdsl, vdom]
43

54
import ".."/[types, formatters]
@@ -38,7 +37,7 @@ proc renderReplies*(replies: Result[Chain]; prefs: Prefs; path: string): VNode =
3837
renderReplyThread(thread, prefs, path)
3938

4039
if replies.bottom.len > 0:
41-
renderMore(Query(), encodeUrl(replies.bottom), focus="#r")
40+
renderMore(Query(), replies.bottom, focus="#r")
4241

4342
proc renderConversation*(conv: Conversation; prefs: Prefs; path: string): VNode =
4443
let hasAfter = conv.after.content.len > 0

src/views/timeline.nim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ proc renderNewer*(query: Query; path: string; focus=""): VNode =
2626

2727
proc renderMore*(query: Query; cursor: string; focus=""): VNode =
2828
buildHtml(tdiv(class="show-more")):
29-
a(href=(&"?{getQuery(query)}cursor={encodeUrl(cursor)}{focus}")):
29+
a(href=(&"?{getQuery(query)}cursor={encodeUrl(cursor, usePlus=false)}{focus}")):
3030
text "Load more"
3131

3232
proc renderNoMore(): VNode =

0 commit comments

Comments
 (0)