mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2025-08-22 14:24:03 -07:00
Fixed filename sanitation in windows
This commit is contained in:
parent
aa85963987
commit
92e42657c3
1 changed files with 6 additions and 0 deletions
|
@ -197,6 +197,12 @@ def sanitize_filename(s):
|
||||||
if char in u' .\\/|?*<>:"' or ord(char) < 32:
|
if char in u' .\\/|?*<>:"' or ord(char) < 32:
|
||||||
return '_'
|
return '_'
|
||||||
return char
|
return char
|
||||||
|
|
||||||
|
if sys.platform == 'win32':
|
||||||
|
s = s.replace(ur'/', u'%')
|
||||||
|
s = re.sub(ur' *[:\|] *', u' - ', s)
|
||||||
|
s = re.sub(ur'[/<>"\?\*]', u'', s)
|
||||||
|
|
||||||
return u''.join(map(replace_insane, s)).strip('_')
|
return u''.join(map(replace_insane, s)).strip('_')
|
||||||
|
|
||||||
def orderedSet(iterable):
|
def orderedSet(iterable):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue