Subject: Re: bug#76982: 30.1; url-generic-parse-url cannot parse Windows file paths

From: Sebastián Monía <[email-masked]>
Date: Mon, 07 Apr 2025 11:48:45 -0400

Eli Zaretskii <[email-masked]> 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"))

> 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.

-- 
Sebastián Monía
https://site.sebasmonia.com/