Subject: bug#42431: 28.0.50; browse-url-of-dired-file confusing messaging

From: Eli Zaretskii <[email-masked]>
Date: Sat, 08 Aug 2020 13:22:47 +0300

> From: Lars Ingebrigtsen <[email-masked]>
> Cc: [email-masked],  [email-masked]
> Date: Sat, 08 Aug 2020 12:05:04 +0200
> 
> >> 	  (condition-case ()
> >> 	      (let ((inhibit-read-only t))
> >> 		(insert-file-contents-literally filename t))
> >> 	    (file-error
> >> 	     (when (and (file-exists-p filename)
> >> 			(not (file-readable-p filename)))
> >> 	       (kill-buffer buf)
> >> 	       (signal 'file-error (list "File is not readable"
> >> 					 filename)))
> >
> > Is this because file-readable-p returns nil for file:// URLs?
> 
> That's the direct cause of the message, but the underlying reason is
> that insert-file-contents-literally signalled a file-error here (after
> inserting the contents).  I haven't yet chased down why.

I guess that's because expand-file-name doesn't convert file:// URLs
into local file names, and then insert-file-contents chokes on the
value produced by expand-file-name.  (insert-file-contents-literally
is just a thin wrapper around insert-file-contents.)

So one solution would be to convert file:// URLs into local file names
in the above snippet, before calling insert-file-contents-literally.