Skip to content

Commit

Permalink
WinPlatform.normalize_path no longer changes the UNC drive case
Browse files Browse the repository at this point in the history
  • Loading branch information
MHendricks committed Dec 4, 2024
1 parent a429d01 commit 177503d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion hab/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,8 @@ def normalize_path(cls, path):
This ensures that the drive letter is resolved consistently to uppercase.
"""
if not path.is_absolute():
# Don't change the case of relative or UNC paths
if not path.is_absolute() or ":" not in path.drive:
return path
parts = path.parts
cls = type(path)
Expand Down
4 changes: 4 additions & 0 deletions tests/test_resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -851,8 +851,12 @@ def test_normalize_path_preserves_cls(self, cls, platform):
# the drive letter is always upper-cased if specified
(r"c:\temp", "C:/temp"),
(r"C:\temp", "C:/temp"),
(r"C:\teMP", "C:/teMP"),
(r"z:\subfolder", "Z:/subfolder"),
(r"relative\path", "relative/path"),
# UNC file paths do not have case changed
(r"\\unc\share\folder", "//unc/share/folder"),
(r"\\UnC\shaRe\folDer", "//UnC/shaRe/folDer"),
),
)
def test_normalize_path_windows(self, path, check):
Expand Down

0 comments on commit 177503d

Please sign in to comment.