Added backslash in path sanitization and removed redundant sanitization in sanitize_windows_path

This commit is contained in:
Felix 2020-11-19 18:27:28 +01:00
parent ba9215ebe8
commit 373ba57bbf
2 changed files with 2 additions and 2 deletions

View file

@ -27,7 +27,7 @@ PRETTY = PrettyLogger(LOGGER)
def _sanitize_path_name(name: str) -> str:
return name.replace("/", "-")
return name.replace("/", "-").replace("\", "-")
class IliasElementType(Enum):

View file

@ -137,6 +137,6 @@ def sanitize_windows_path(path: PurePath) -> Optional[PurePath]:
"""
# Escape windows illegal path characters
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 path