From 6e491a94b0d7853931c96ebdcc39cd045da59fc5 Mon Sep 17 00:00:00 2001 From: Nick Drozd Date: Sat, 2 Feb 2019 12:50:03 -0600 Subject: [PATCH 3/3] * lisp/net/eww.el (eww-download-callback): Fix download URL path Previously this wasn't handling download URLs correctly, resulting in all downloaded pages being named "!", "!(1)", etc. Take "https://emptysqua.re/blog/getaddrinfo-cpython-mac-and-bsd/" as an example. `url-path-and-query' breaks this down to "/blog/getaddrinfo-cpython-mac-and-bsd/", and this gets passed to `file-name-nondirectory'. But that path looks like a directory because of the trailing slash, so `eww-decode-url-file-name' would end up with an empty string. Instead, remove the trailing slash so that a nonempty file name is passed in. --- lisp/net/eww.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/net/eww.el b/lisp/net/eww.el index 0c8bffa579..da18535fdb 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -1544,7 +1544,7 @@ eww-download (defun eww-download-callback (status url) (unless (plist-get status :error) (let* ((obj (url-generic-parse-url url)) - (path (car (url-path-and-query obj))) + (path (string-remove-suffix "/" (car (url-path-and-query obj)))) (file (eww-make-unique-file-name (eww-decode-url-file-name (file-name-nondirectory path)) eww-download-directory))) -- 2.17.1