diff options
author | Ulf Jasper <> | 2014-10-20 20:39:58 +0200 |
---|---|---|
committer | Ulf Jasper <ulf.jasper@web.de> | 2014-10-20 20:39:58 +0200 |
commit | 1e6e7f33a4e0b4e98c41e7089475888cf593d4c5 (patch) | |
tree | 773e3f93e7fecd594306d5925a37fed05e229d4b /lisp/net/newst-backend.el | |
parent | bc0e9e47b645ecd8da86eb8ae5810ebf2fd62b97 (diff) | |
download | emacs-1e6e7f33a4e0b4e98c41e7089475888cf593d4c5.tar.gz emacs-1e6e7f33a4e0b4e98c41e7089475888cf593d4c5.tar.bz2 emacs-1e6e7f33a4e0b4e98c41e7089475888cf593d4c5.zip |
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.
Diffstat (limited to 'lisp/net/newst-backend.el')
-rw-r--r-- | lisp/net/newst-backend.el | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/lisp/net/newst-backend.el b/lisp/net/newst-backend.el index 4052116074d..a8b0d1b7d62 100644 --- a/lisp/net/newst-backend.el +++ b/lisp/net/newst-backend.el @@ -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." |