aboutsummaryrefslogtreecommitdiff
path: root/emacs/.emacs.d/lisp/my/infobox.el
diff options
context:
space:
mode:
Diffstat (limited to 'emacs/.emacs.d/lisp/my/infobox.el')
-rw-r--r--emacs/.emacs.d/lisp/my/infobox.el8
1 files changed, 6 insertions, 2 deletions
diff --git a/emacs/.emacs.d/lisp/my/infobox.el b/emacs/.emacs.d/lisp/my/infobox.el
index 2a17dc9..0e5e054 100644
--- a/emacs/.emacs.d/lisp/my/infobox.el
+++ b/emacs/.emacs.d/lisp/my/infobox.el
@@ -70,8 +70,12 @@ something like
;; TODO: use a more standard function than
;; `my-make-filename-from-url'
(when-let* ((thumb-url (alist-get "Thumbnail" info nil nil 'equal))
- (file-name (make-temp-name "/tmp/infobox-")))
- (url-copy-file thumb-url file-name t)
+ (file-name
+ (if (string-prefix-p "file://" thumb-url)
+ (string-remove-prefix "file://" thumb-url)
+ (make-temp-name "/tmp/infobox-"))))
+ (unless (string-prefix-p "file://" thumb-url)
+ (url-copy-file thumb-url file-name t))
(insert-image (create-image file-name nil nil
:max-width (window-pixel-width)
:max-height (/ (window-pixel-height) 2)))