From 422a413bd5904b042cde18f31d91223ce92cd66b Mon Sep 17 00:00:00 2001 From: hseg Date: Thu, 11 Apr 2019 02:30:32 +0300 Subject: [PATCH] Strip surrounding whitespace in filenames Such spaces are annoying enough to deal with, and break external downloaders trying to be smart (such as aria2c). Fixes #20312. --- youtube_dl/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py index 71713f63a..a42618238 100644 --- a/youtube_dl/utils.py +++ b/youtube_dl/utils.py @@ -509,7 +509,7 @@ def sanitize_filename(s, restricted=False, is_id=False): if not is_id: while '__' in result: result = result.replace('__', '_') - result = result.strip('_') + result = result.strip(' _') # Common case of "Foreign band name - English song title" if restricted and result.startswith('-_'): result = result[2:]