mirror of
https://github.com/Garmelon/PFERD.git
synced 2026-04-13 07:55:05 +02:00
Added backslash in path sanitization and removed redundant sanitization in sanitize_windows_path
This commit is contained in:
parent
ba9215ebe8
commit
373ba57bbf
2 changed files with 2 additions and 2 deletions
|
|
@ -27,7 +27,7 @@ PRETTY = PrettyLogger(LOGGER)
|
||||||
|
|
||||||
|
|
||||||
def _sanitize_path_name(name: str) -> str:
|
def _sanitize_path_name(name: str) -> str:
|
||||||
return name.replace("/", "-")
|
return name.replace("/", "-").replace("\", "-")
|
||||||
|
|
||||||
|
|
||||||
class IliasElementType(Enum):
|
class IliasElementType(Enum):
|
||||||
|
|
|
||||||
|
|
@ -137,6 +137,6 @@ def sanitize_windows_path(path: PurePath) -> Optional[PurePath]:
|
||||||
"""
|
"""
|
||||||
# Escape windows illegal path characters
|
# Escape windows illegal path characters
|
||||||
if os.name == 'nt':
|
if os.name == 'nt':
|
||||||
sanitized_parts = [re.sub(r'[<>:"/|?]', "_", x) for x in list(path.parts)]
|
sanitized_parts = [re.sub(r'[<>:"|?]', "_", x) for x in list(path.parts)]
|
||||||
return PurePath(*sanitized_parts)
|
return PurePath(*sanitized_parts)
|
||||||
return path
|
return path
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue