Subject: Re: bug#39235: 26.3; SHR: base handling errors on "."

From: Lars Ingebrigtsen <[email-masked]>
Date: Thu, 20 Feb 2020 15:15:25 +0100

Kevin Brubeck Unhammer <[email-masked]> writes:

>     (require 'shr)
>     (let ((shr-base (shr-parse-base ".")))
>        (shr-expand-url "www.example.com"))
>
> errors with
>
> Debugger entered--Lisp error: (wrong-type-argument char-or-string-p nil)
>   url-scheme-get-property(nil expand-file-name)
>   url-expand-file-name("www.example.com" "./")
>   shr-expand-url("www.example.com")

The bug here doesn't seem to be with "." per se, but when both the base
and the URL to be expanded have no protocol.

(let ((shr-base (shr-parse-base "/tmp")))
   (shr-expand-url "foo"))
=> error

(let ((shr-base (shr-parse-base "foo:/tmp")))
   (shr-expand-url "foo"))
=> "foo:foo"

(let ((shr-base (shr-parse-base "/tmp")))
   (shr-expand-url "foo:foo"))
=> "foo:foo"

I've now fixed this in the url.el library in Emacs 28.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no