1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-21 06:55:39 +00:00

Allow shr to use data: URLs without encoding

* lisp/net/shr.el (shr-image-from-data): Don't bug out on
image data: URLs that have no base64 encoding like
(shr-image-from-data
"text/html,%3Ch1%3EHello%2C%20World!%3C%2Fh1%3E").
This commit is contained in:
Lars Ingebrigtsen 2017-12-03 23:46:52 +01:00
parent 1fdac2d65c
commit 4b06af0643

View File

@ -994,7 +994,8 @@ If EXTERNAL, browse the URL using `shr-external-browser'."
data)
(let ((param (match-string 4 data))
(payload (url-unhex-string (match-string 5 data))))
(when (string-match "^.*\\(;[ \t]*base64\\)$" param)
(when (and param
(string-match "^.*\\(;[ \t]*base64\\)$" param))
(setq payload (ignore-errors
(base64-decode-string payload))))
payload)))