summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2020-02-20 15:14:39 +0100
committerLars Ingebrigtsen <larsi@gnus.org>2020-02-20 15:14:39 +0100
commit3ac834951786a73995c1fc9748395e9866f98f30 (patch)
tree944512aa9a262d0cdf49ca9babaf5a72ff7c38c5
parent55ad194922d357e7ee2c0d728a51dbfee54bcf0c (diff)
downloademacs-3ac834951786a73995c1fc9748395e9866f98f30.tar.gz
Fix problem with degenerate <html base="."> specs in shr
* lisp/url/url-expand.el (url-expand-file-name): Don't bug out on degenerate base/expander pairs (bug#39235).
-rw-r--r--lisp/url/url-expand.el11
1 files changed, 9 insertions, 2 deletions
diff --git a/lisp/url/url-expand.el b/lisp/url/url-expand.el
index 47964b081f4..f34ef810c4a 100644
--- a/lisp/url/url-expand.el
+++ b/lisp/url/url-expand.el
@@ -92,12 +92,19 @@ path components followed by `..' are removed, along with the `..' itself."
(cond
((= (length url) 0) ; nil or empty string
(url-recreate-url default))
- ((string-match url-nonrelative-link url) ; Fully-qualified URL, return it immediately
+ ((string-match url-nonrelative-link url) ; Fully-qualified URL,
+ ; return it immediately
url)
(t
(let* ((urlobj (url-generic-parse-url url))
(inhibit-file-name-handlers t)
- (expander (url-scheme-get-property (url-type default) 'expand-file-name)))
+ (expander (if (url-type default)
+ (url-scheme-get-property (url-type default)
+ 'expand-file-name)
+ ;; If neither the default nor the URL to be
+ ;; expanded have a protocol, then just use the
+ ;; identity expander as a fallback.
+ 'url-identity-expander)))
(if (string-match "^//" url)
(setq urlobj (url-generic-parse-url (concat (url-type default) ":"
url))))