pallets / jinja

A very fast and expressive template engine.
https://jinja.palletsprojects.com
BSD 3-Clause "New" or "Revised" License
10.23k stars 1.6k forks source link

Support Windows UNC paths in loaders #1913

Open KapJI opened 9 months ago

KapJI commented 9 months ago

Replace os.path.normpath with str(pathlib.Path()) which correctly fixes path separators when UNC path is provided.

Tested that this code doesn't escape search dir, e.g.:

>>> str(pathlib.Path(posixpath.join("C:\\abc", "e:d\\ef")))
'C:\\abc\\e:d\\ef'
>>> str(pathlib.Path(posixpath.join("\\\\?\\C:\\abc", "e:d\\ef")))
'\\\\?\\C:\\abc\\e:d\\ef'

Checklist: