]> code.delx.au - gnu-emacs/commitdiff
shr: strip leading whitespace when expanding URLs
authorAndreas Schwab <schwab@linux-m68k.org>
Fri, 24 Apr 2015 15:18:55 +0000 (17:18 +0200)
committerAndreas Schwab <schwab@linux-m68k.org>
Fri, 24 Apr 2015 15:19:31 +0000 (17:19 +0200)
* lisp/net/shr.el (shr-expand-url): Strip leading whitespace from URL.

lisp/net/shr.el

index 9d88d1ff4419b74fa7ed81dbdf823470d39d963f..454332e55d0f9e679cae4302eb6bdadadff62515 100644 (file)
@@ -709,6 +709,9 @@ size, and full-buffer size."
          shr-base))
   (when (zerop (length url))
     (setq url nil))
+  ;; Strip leading whitespace
+  (and url (string-match "\\`\\s-+" url)
+       (setq url (substring url (match-end 0))))
   (cond ((or (not url)
             (not base)
             (string-match "\\`[a-z]*:" url))