mirror of
https://github.com/Garmelon/PFERD.git
synced 2023-12-21 10:23:01 +01:00
Use "_" as a replacement for illegal characters
This commit is contained in:
parent
f2aba970fd
commit
4ac51048c1
@ -15,14 +15,13 @@ from PFERD import Pferd
|
|||||||
from PFERD.cookie_jar import CookieJar
|
from PFERD.cookie_jar import CookieJar
|
||||||
from PFERD.ilias import (IliasCrawler, IliasElementType,
|
from PFERD.ilias import (IliasCrawler, IliasElementType,
|
||||||
KitShibbolethAuthenticator)
|
KitShibbolethAuthenticator)
|
||||||
from PFERD.transform import re_rename
|
|
||||||
from PFERD.utils import to_path
|
from PFERD.utils import to_path
|
||||||
|
|
||||||
|
|
||||||
def sanitize_path(path: PurePath) -> Optional[PurePath]:
|
def sanitize_path(path: PurePath) -> Optional[PurePath]:
|
||||||
# Escape windows illegal path characters
|
# Escape windows illegal path characters
|
||||||
if os.name == 'nt':
|
if os.name == 'nt':
|
||||||
return PurePath(re.sub(r'[<>:"/\\|?]', "", str(path)))
|
return PurePath(re.sub(r'[<>:"/\\|?]', "_", str(path)))
|
||||||
return path
|
return path
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user