[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#76982: 30.1; url-generic-parse-url cannot parse Windows file paths
From: |
Sebastián Monía |
Subject: |
bug#76982: 30.1; url-generic-parse-url cannot parse Windows file paths |
Date: |
Mon, 07 Apr 2025 00:18:57 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Hello,
Attached a new patch, with some tests and updated changelog.
Eli Zaretskii <eliz@gnu.org> writes:
> Ping! Sebastián, would you like to submit an updated patch which
> addresses my comments?
>
>> > @@ -210,6 +215,13 @@ url-generic-parse-url
>> >
>> > (if (and host (string-match "%[0-9][0-9]" host))
>> > (setq host (url-unhex-string host)))
>> > +
>> > + ;; For file:// URIs, if the path "looks like" Windows/DOS, it
>> > + ;; makes sense to strip the leading slash (bug#76982)
>> > + (when (and (string= "file" scheme)
>> > + (string-match "^/[A-Za-z]:[/\\]" file))
>> > + (setq file (substring file 1)))
>> > +
>> > (url-parse-make-urlobj scheme user pass host port file
>> > fragment nil full))))))
>>
>> Isn't it cleaner to go one more character forward here:
>>
>> ;; 3.2. Authority
>> (when (looking-at "//")
>> (setq full t)
>> (forward-char 2) <<<<<<<<<<<<<<<<<<<<
>> (setq save-pos (point))
>> (skip-chars-forward "^/?#")
>>
>> if the conditions for Windows-style absolute file name are fulfilled?
The URI could potentially have components before we get to the filename,
so the look head for "path starts with" isn't as clean.
In this patch I still do that check in the same place as in the
original.
Thank you,
Seb
0001-Special-treatment-for-file-URIs-that-look-like-Windo.patch
Description: Strip leading /
--
Sebastián Monía
https://site.sebasmonia.com/
- bug#76982: 30.1; url-generic-parse-url cannot parse Windows file paths,
Sebastián Monía <=