]> git.eshelyaron.com Git - emacs.git/commitdiff
Allow shr to use data: URLs without encoding
authorLars Ingebrigtsen <larsi@gnus.org>
Sun, 3 Dec 2017 22:46:52 +0000 (23:46 +0100)
committerLars Ingebrigtsen <larsi@gnus.org>
Sun, 3 Dec 2017 22:49:56 +0000 (23:49 +0100)
* 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").

lisp/net/shr.el

index ab7240c8c3d9a684101530e8ff7cdd16bc3c8461..ad5d869531cc93fdbd473eb76f86627b0394e267 100644 (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)))