branch: elpa/mastodon
commit a825e44f45d9d9a7982ea16931c6b02ad5faa144
Author: Slava Barinov <slava.barinov@woven-planet.global>
Commit: Slava Barinov <raysl...@gmail.com>

    http: trim the json-string
    
    Some servers (e.g. Mitra) adds a single newline in the end of answer which
    results into (error "\n")
---
 lisp/mastodon-http.el | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/lisp/mastodon-http.el b/lisp/mastodon-http.el
index a55097dff2..a91f272dd4 100644
--- a/lisp/mastodon-http.el
+++ b/lisp/mastodon-http.el
@@ -220,9 +220,10 @@ Callback to `mastodon-http--get-response-async', usually
     (goto-char (point-min))
     (re-search-forward "^$" nil 'move)
     (let ((json-array-type (if vector 'vector 'list))
-          (json-string (decode-coding-string
-                        (buffer-substring-no-properties (point) (point-max))
-                        'utf-8)))
+          (json-string (string-trim-right
+                        (decode-coding-string
+                         (buffer-substring-no-properties (point) (point-max))
+                         'utf-8))))
       (kill-buffer)
       (cond ((or (string-empty-p json-string) (null json-string))
              nil)

Reply via email to