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.el11
1 files changed, 7 insertions, 4 deletions
diff --git a/lisp/mastodon-http.el b/lisp/mastodon-http.el
index 1edc8b5..a357672 100644
--- a/lisp/mastodon-http.el
+++ b/lisp/mastodon-http.el
@@ -5,7 +5,6 @@
;; Author: Johnson Denen <johnson.denen@gmail.com>
;; Marty Hiatt <martianhiatus@riseup.net>
;; Maintainer: Marty Hiatt <martianhiatus@riseup.net>
-;; Version: 1.0.0
;; Homepage: https://codeberg.org/martianh/mastodon.el
;; This file is not part of GNU Emacs.
@@ -98,10 +97,14 @@ RESPONSE if unsuccessful."
(mastodon-http--process-json))))
(message "Error %s: %s" status (alist-get 'error json-response)))))))
-(defun mastodon-http--read-file-as-string (filename)
- "Read a file FILENAME as a string. Used to generate image preview."
+(defun mastodon-http--read-file-as-string (filename &optional url)
+ "Read a file FILENAME as a string.
+Used to generate image preview.
+URL means FILENAME is a URL."
(with-temp-buffer
- (insert-file-contents filename)
+ (if url
+ (url-insert-file-contents filename)
+ (insert-file-contents filename))
(string-to-unibyte (buffer-string))))
(defmacro mastodon-http--authorized-request (method body &optional unauthenticated-p)