Skip to content

Fix %-encoding in UriToFilePath#1815

Merged
puremourning merged 1 commit intoycm-core:masterfrom
puremourning:fix-uritofilepath
Mar 1, 2026
Merged

Fix %-encoding in UriToFilePath#1815
puremourning merged 1 commit intoycm-core:masterfrom
puremourning:fix-uritofilepath

Conversation

@puremourning
Copy link
Member

@puremourning puremourning commented Mar 1, 2026

In #1119 a change was made to "unquote" the URI before converting to a file path, ostensibly to support windows. It seems that either that change was broken, or that Python standard library has since been fixed and this has caused legitimate %-encoded paths (like foo#bar/test.c) to now truncate at the #.

The tests added for UriToFilePath with Windows paths still pass unchanged without the hack on Python 3.14 so I'm happy to just remove the hack.

Fixes #1814


This change is Reviewable

@puremourning
Copy link
Member Author

hmm it does seem that the change was in Python 3.14: https://docs.python.org/3/library/urllib.request.html#urllib.request.url2pathname

And require_scheme was only added in Python 3.14 so we can't merge this as is.

In ycm-core#1119 a change was made to "unquote" the URI before converting to a
file path, ostensibly to support windows. It seems that in Python 3.14
the underlying issue this was working around was fixed, and as a result
we're broken, leading to paths being truncated.

The tests added for UriToFilePath with Windows paths still pass
unchanged without the hack on Python 3.14 and the new test passes on
pre-3.14 with the hack, so we have to gate it on version, sadly.
@puremourning puremourning merged commit a290328 into ycm-core:master Mar 1, 2026
8 checks passed
@puremourning puremourning deleted the fix-uritofilepath branch March 1, 2026 18:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect paths reported with url encoded URIs from LSP

1 participant