aboutsummaryrefslogtreecommitdiff
path: root/lisp/mastodon-tl.el
diff options
context:
space:
mode:
authormarty hiatt <martianhiatus [a t] riseup [d o t] net>2023-02-18 22:07:17 +0100
committermarty hiatt <martianhiatus [a t] riseup [d o t] net>2023-02-18 22:07:52 +0100
commit03eb2c807c7a07718b2c811038477eff014032b7 (patch)
tree05c1ec3e60b50be322b970f881c9ca29cc2378d4 /lisp/mastodon-tl.el
parent3823bfa94c43d9d26190e5c25ebb159933b7cc2b (diff)
handle no "next" link header, roughly
Diffstat (limited to 'lisp/mastodon-tl.el')
-rw-r--r--lisp/mastodon-tl.el25
1 files changed, 15 insertions, 10 deletions
diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el
index 87bac66..4323c66 100644
--- a/lisp/mastodon-tl.el
+++ b/lisp/mastodon-tl.el
@@ -2767,16 +2767,21 @@ when showing followers or accounts followed."
(message "Loading older toots...")
(if (mastodon-tl--use-link-header-p)
;; link-header: can't build a URL with --more-json-async, endpoint/id:
- (let* ((next (car (mastodon-tl--link-header)))
- ;;(prev (cadr (mastodon-tl--link-header)))
- (url (mastodon-tl--build-link-header-url next)))
- (mastodon-http--get-response-async url nil 'mastodon-tl--more* (current-buffer)
- (point) :headers))
- (mastodon-tl--more-json-async
- (mastodon-tl--get-endpoint)
- (mastodon-tl--oldest-id)
- (mastodon-tl--update-params)
- 'mastodon-tl--more* (current-buffer) (point))))
+ ;; ensure we have a "next" type here, otherwise the CAR will be the
+ ;; "prev type!"
+ (let (link-header (mastodon-tl--link-header))
+ (if (> 2 (length link-header))
+ (error "No next page")
+ (let* ((next (car link-header))
+ ;;(prev (cadr (mastodon-tl--link-header)))
+ (url (mastodon-tl--build-link-header-url next)))
+ (mastodon-http--get-response-async url nil 'mastodon-tl--more* (current-buffer)
+ (point) :headers))
+ (mastodon-tl--more-json-async
+ (mastodon-tl--get-endpoint)
+ (mastodon-tl--oldest-id)
+ (mastodon-tl--update-params)
+ 'mastodon-tl--more* (current-buffer) (point))))))
(defun mastodon-tl--more* (response buffer point-before &optional headers)
"Append older toots to timeline, asynchronously.