aboutsummaryrefslogtreecommitdiff
path: root/lisp/mastodon-http.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/mastodon-http.el')
-rw-r--r--lisp/mastodon-http.el8
1 files changed, 5 insertions, 3 deletions
diff --git a/lisp/mastodon-http.el b/lisp/mastodon-http.el
index 6e7bfb3..37770ef 100644
--- a/lisp/mastodon-http.el
+++ b/lisp/mastodon-http.el
@@ -88,11 +88,13 @@ Message status and JSON error from RESPONSE if unsuccessful."
(mastodon-http--status))))
(if (string-prefix-p "2" status)
(funcall success)
- (switch-to-buffer response)
- ;; 404 returns http response not JSON:
+ ;; don't switch to buffer, just with-current-buffer the response:
+ ;; (switch-to-buffer response)
+ ;; 404 sometimes returns http response so --process-json fails:
(if (string-prefix-p "404" status)
(message "Error %s: page not found" status)
- (let ((json-response (mastodon-http--process-json)))
+ (let ((json-response (with-current-buffer response
+ (mastodon-http--process-json))))
(message "Error %s: %s" status (alist-get 'error json-response)))))))
(defun mastodon-http--read-file-as-string (filename)