mirror of
https://zotify.xyz/zotify/zotify.git
synced 2025-06-22 13:26:44 +00:00
Remove more special characters irrespective of filesystem support
Having colons, asterisks, question marks, pipes, and other control characters, while valid on UNIX/Linux/MacOS systems, is not good for portability. It doesn't take much away to remove this, and ensures consistent file names across multiple platforms.
This commit is contained in:
parent
5da27d32a1
commit
ad9c5df7a0
1 changed files with 2 additions and 2 deletions
|
@ -261,9 +261,9 @@ def fix_filename(name):
|
|||
if platform.system() == WINDOWS_SYSTEM:
|
||||
return re.sub(r'[/\\:|<>"?*\0-\x1f]|^(AUX|COM[1-9]|CON|LPT[1-9]|NUL|PRN)(?![^.])|^\s|[\s.]$', "_", str(name), flags=re.IGNORECASE)
|
||||
elif platform.system() == LINUX_SYSTEM:
|
||||
return re.sub(r'[/\0]', "_", str(name))
|
||||
return re.sub(r'[/\\:|<>"?*\0-\x1f]|^(AUX|COM[1-9]|CON|LPT[1-9]|NUL|PRN)(?![^.])|^\s|[\s.]$', "_", str(name), flags=re.IGNORECASE)
|
||||
else: # MacOS
|
||||
return re.sub(r'[/:\0]', "_", str(name))
|
||||
return re.sub(r'[/\\:|<>"?*\0-\x1f]|^(AUX|COM[1-9]|CON|LPT[1-9]|NUL|PRN)(?![^.])|^\s|[\s.]$', "_", str(name), flags=re.IGNORECASE)
|
||||
|
||||
|
||||
def fmt_seconds(secs: float) -> str:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue