[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#15285: url-data not working for base64-encoded data
From: |
Glenn Morris |
Subject: |
bug#15285: url-data not working for base64-encoded data |
Date: |
Mon, 16 Sep 2013 17:31:54 -0400 |
User-agent: |
Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) |
Version: 24.4
Thanks for the clear report.
(I needed to add a "(require 'mm-view)" to the test-case).
I think this fixes it:
*** lisp/url/url-misc.el 2013-01-02 16:13:04 +0000
--- lisp/url/url-misc.el 2013-09-16 21:28:11 +0000
***************
*** 89,107 ****
(save-excursion
(if (not (string-match "\\([^,]*\\)?," desc))
(error "Malformed data URL: %s" desc)
! (setq mediatype (match-string 1 desc))
(if (and mediatype (string-match ";base64\\'" mediatype))
(setq mediatype (substring mediatype 0 (match-beginning 0))
encoding "base64"))
(if (or (null mediatype)
(eq ?\; (aref mediatype 0)))
! (setq mediatype (concat "text/plain" mediatype)))
! (setq data (url-unhex-string (substring desc (match-end 0)))))
(set-buffer (generate-new-buffer " *url-data*"))
(mm-disable-multibyte)
(insert (format "Content-Length: %d\n" (length data))
"Content-Type: " mediatype "\n"
! "Content-Encoding: " encoding "\n"
"\n")
(if data (insert data))
(current-buffer))))
--- 88,106 ----
(save-excursion
(if (not (string-match "\\([^,]*\\)?," desc))
(error "Malformed data URL: %s" desc)
! (setq mediatype (match-string 1 desc)
! data (url-unhex-string (substring desc (match-end 0))))
(if (and mediatype (string-match ";base64\\'" mediatype))
(setq mediatype (substring mediatype 0 (match-beginning 0))
encoding "base64"))
(if (or (null mediatype)
(eq ?\; (aref mediatype 0)))
! (setq mediatype (concat "text/plain" mediatype))))
(set-buffer (generate-new-buffer " *url-data*"))
(mm-disable-multibyte)
(insert (format "Content-Length: %d\n" (length data))
"Content-Type: " mediatype "\n"
! "Content-Transfer-Encoding: " encoding "\n"
"\n")
(if data (insert data))
(current-buffer))))