Commit 1e6e7f33 authored by Ulf Jasper's avatar Ulf Jasper Committed by Ulf Jasper
Browse files

Newsticker: fix broken image download via url-retrieve.

* lisp/net/newst-backend.el
(newsticker--image-download-by-url-callback): Make this function
actually work: First save image then check status.
parent bc0e9e47
2014-10-20 Ulf Jasper <ulf.jasper@web.de>
* net/newst-backend.el
(newsticker--image-download-by-url-callback): Make this function
actually work: First save image then check status.
2014-10-20 Stefan Monnier <monnier@iro.umontreal.ca>
 
* textmodes/css-mode.el (scss-mode): New major-mode.
......
......@@ -1905,23 +1905,29 @@ STATUS is the return status as delivered by `url-retrieve'.
FEED-NAME is the name of the feed that the news were retrieved
from.
The image is saved in DIRECTORY as FILENAME."
(let ((buf (get-buffer-create (concat " *newsticker-url-image-" feed-name "-"
directory "*")))
(result (string-to-multibyte (buffer-string))))
(set-buffer buf)
(erase-buffer)
(insert result)
;; remove MIME header
(goto-char (point-min))
(search-forward "\n\n")
(delete-region (point-min) (point))
;; save
(newsticker--image-save buf directory filename))
(when status
(let ((status-type (car status))
(status-details (cdr status)))
(cond ((eq status-type :error)
(newsticker--image-remove directory feed-name))
(t
(let ((buf (get-buffer-create (concat " *newsticker-url-image-" feed-name "-" directory "*")))
(result (string-to-multibyte (buffer-string))))
(set-buffer buf)
(erase-buffer)
(insert result)
;; remove MIME header
(goto-char (point-min))
(search-forward "\n\n")
(delete-region (point-min) (point))
;; save
(newsticker--image-save buf directory filename)))))))
(cond ((eq status-type :redirect)
;; don't care about redirects
)
((eq status-type :error)
(message "%s: Error while retrieving image from %s: %s: \"%s\""
(format-time-string "%A, %H:%M" (current-time))
feed-name
(car status-details) (cdr status-details)))))))
(defun newsticker--insert-image (img string)
"Insert IMG with STRING at point."
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment