Feedback on a PR regarding : and | in URLs

Hello,

I recently created #32567 (Issues with ":" and "|" characters in URLs when using LiveServerTestCase on Windows) – Django and started working on a PR Refs #32567 - LiveServerTestCase fails when URL has special characters on Windows by timoguic · Pull Request #14146 · django/django · GitHub

However I am not sure that this is the correct solution. “:” and “|” are accepted in URLs, but they are not valid in Windows file names (clash with drives). pathlib.is_reserved does not have a problem with them, but they get converted wrong.

This actually happens in the url2pathname function, defined in the stdlib (nturl2path.py).
Specifically:

# Windows itself uses ":" even in URLs.
url = url.replace(':', '|')

What is the best way to approach this?

Hi @timoguic — we’ll get to looking at the PR as soon as we can — it’s probably easier to discuss there, where we have the diffs available.

Thanks for the input! Welcome aboard! :sailboat: