GNU bug report logs - #76982
30.1; url-generic-parse-url cannot parse Windows file paths

Previous Next

Package: emacs;

Reported by: Morgan Willcock <morgan <at> ice9.digital>

Date: Wed, 12 Mar 2025 17:54:02 UTC

Severity: normal

Tags: patch

Found in version 30.1

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Sebastián Monía <sebastian <at> sebasmonia.com>
To: "Eli Zaretskii" <eliz <at> gnu.org>
Cc: 76982 <at> debbugs.gnu.org, morgan <at> ice9.digital
Subject: bug#76982: 30.1; url-generic-parse-url cannot parse Windows file paths
Date: Tue, 08 Apr 2025 18:13:57 -0400
[Message part 1 (text/plain, inline)]
Hello!

On Mon, Apr 7, 2025, at 11:48 AM, Sebastián Monía wrote:
> Eli Zaretskii <eliz <at> gnu.org> writes:
> > It can have other components in file:// URIs?  If so, can you show an
> > example?
> 
> The URIs can have an "authority" segment, an example from
> https://www.rfc-editor.org/rfc/rfc8089.html#appendix-B
> 
> "file://host.example.com/path/to/file"
> 
> And also I just noticed that "localhost" is valid for authority, so I
> should add a test like this:
> 
> (should (equal (url-filename (url-generic-parse-url "file://localhost/c:/path/to/file")) "c:/path/to/file"))

Added this test.

> > The problem with your proposal is that the value of 'file' is
> > incorrect between where it is first set and where you correct it.  Any
> > code added later that uses 'file' in-between might cause bugs if the
> > person who adds such code is not aware of this subtlety.  By contrast,
> > under my suggestion 'file' has the correct value from the get-go.
> 
> You are right :) I hadn't considered this. Will revisit the code and see
> how I can handle things earlier.

Now the leading / is stripped much closer to where the 'file' variable 
assignment takes place, and also after the hostname/authority portion. 

Let me know what you think!
Seb

-- 
Sebastián Monía
https://site.sebasmonia.com/
[0001-Special-treatment-for-file-URIs-that-look-like-Windo.patch (application/octet-stream, attachment)]

This bug report was last modified 37 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.