mirror of
https://github.com/vale981/ement.el
synced 2025-03-04 17:01:39 -05:00
Fix: (ement-room--format-m.image) Handle missing URLs
Not sure why this can happen, but occasionally it does (maybe only while debugging or when other bugs cause incomplete event insertion).
This commit is contained in:
parent
9d1baf6670
commit
44580a8a25
1 changed files with 6 additions and 5 deletions
|
@ -3132,12 +3132,13 @@ show it in the buffer."
|
|||
((cl-struct ement-room local) ement-room)
|
||||
((map buffer) local)
|
||||
;; TODO: Thumbnail support.
|
||||
((map url info ;; (thumbnail_url thumbnail-url)
|
||||
((map ('url mxc) info ;; ('thumbnail_url thumbnail-url)
|
||||
) content)
|
||||
((map thumbnail_info) info)
|
||||
((map ('h _thumbnail-height) ('w _thumbnail-width)) thumbnail_info)
|
||||
((map image) event-local)
|
||||
(url (ement--mxc-to-url url ement-session))
|
||||
(url (when mxc
|
||||
(ement--mxc-to-url mxc ement-session)))
|
||||
;; (thumbnail-url (ement--mxc-to-url thumbnail-url ement-session))
|
||||
)
|
||||
(if (and ement-room-images image)
|
||||
|
@ -3177,12 +3178,12 @@ show it in the buffer."
|
|||
;; Image not downloaded: insert URL as button, and download if enabled.
|
||||
(prog1
|
||||
(with-temp-buffer
|
||||
(insert-text-button url
|
||||
(insert-text-button (or url "[no URL for image]")
|
||||
'face 'link
|
||||
'follow-link t)
|
||||
(buffer-string))
|
||||
(when ement-room-images
|
||||
;; Images enabled: download it.
|
||||
(when (and ement-room-images url)
|
||||
;; Images enabled and URL present: download it.
|
||||
(plz 'get url :as 'binary
|
||||
:then (apply-partially #'ement-room--m.image-callback event ement-room)
|
||||
:noquery t))))))
|
||||
|
|
Loading…
Add table
Reference in a new issue