mirror of
https://github.com/l1ving/youtube-dl
synced 2026-06-07 21:24:28 +08:00
strip the leading dots of a file name in case of hidden file
This commit is contained in:
@@ -294,6 +294,8 @@ def sanitize_filename(s, restricted=False, is_id=False):
|
||||
return '_'
|
||||
return char
|
||||
|
||||
if s.startswith('.'):
|
||||
s = s.lstrip('.')
|
||||
# Handle timestamps
|
||||
s = re.sub(r'[0-9]+(?::[0-9]+)+', lambda m: m.group(0).replace(':', '_'), s)
|
||||
result = ''.join(map(replace_insane, s))
|
||||
|
||||
Reference in New Issue
Block a user