From 583a92baf4228c88ea1b6c3ea369d363dc938b23 Mon Sep 17 00:00:00 2001 From: Daniel Hatton Date: Fri, 7 Mar 2025 17:19:51 +0000 Subject: [PATCH 1/2] Add colons back into paths at the end of parts to cover MSYS2 style paths --- src/murfey/util/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/murfey/util/__init__.py b/src/murfey/util/__init__.py index 2c00684f0..a9804361d 100644 --- a/src/murfey/util/__init__.py +++ b/src/murfey/util/__init__.py @@ -78,7 +78,10 @@ def secure_path(in_path: Path, keep_spaces: bool = False) -> Path: secure_filename(p) if " " not in p else p for p in in_path.parts ] else: - secured_parts = [secure_filename(p) for p in in_path.parts] + secured_parts = [ + secure_filename(p) + ":" if p.endswith(":") else secure_filename(p) + for p in in_path.parts + ] return Path("/".join(secured_parts)) From effafb680228a59c518c0660630c2fc2bd767a6f Mon Sep 17 00:00:00 2001 From: Daniel Hatton Date: Tue, 11 Mar 2025 12:05:28 +0000 Subject: [PATCH 2/2] Only keep colon for first part --- src/murfey/util/__init__.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/murfey/util/__init__.py b/src/murfey/util/__init__.py index a9804361d..c1610c98c 100644 --- a/src/murfey/util/__init__.py +++ b/src/murfey/util/__init__.py @@ -79,8 +79,12 @@ def secure_path(in_path: Path, keep_spaces: bool = False) -> Path: ] else: secured_parts = [ - secure_filename(p) + ":" if p.endswith(":") else secure_filename(p) - for p in in_path.parts + ( + secure_filename(part) + ":" + if p == 0 and ":" in part + else secure_filename(part) + ) + for p, part in enumerate(in_path.parts) ] return Path("/".join(secured_parts))