From fd931ec584616bcd2afb657c84c4731ae1b8cb6f Mon Sep 17 00:00:00 2001 From: Raymond Chu Date: Sat, 28 Feb 2015 23:30:33 +0800 Subject: [PATCH] strip the leading dots of a file name in case of hidden file --- youtube_dl/utils.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py index 1f3bfef7d..f7dfb49b1 100644 --- a/youtube_dl/utils.py +++ b/youtube_dl/utils.py @@ -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))