1
0
mirror of https://github.com/l1ving/youtube-dl synced 2026-06-02 11:09:54 +08:00

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.
This commit is contained in:
hseg
2019-04-11 02:30:32 +03:00
committed by GitHub
Unverified
parent 118f7add3b
commit 422a413bd5
+1 -1
View File
@@ -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:]