summary refs log tree commit diff
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2017-04-16 01:39:07 +0700
committerSergey M․ <dstftw@gmail.com>2017-04-16 01:39:07 +0700
commitd35dc344af8ca0b4cc9ea738a290c04842adb9db (patch)
treea552df86e465f607fae82440f985c9414de36716
parent51350db5a395c45cb181b1813a71b5e1aff86993 (diff)
downloadyoutube-dl-d35dc344af8ca0b4cc9ea738a290c04842adb9db.tar.gz
youtube-dl-d35dc344af8ca0b4cc9ea738a290c04842adb9db.tar.xz
youtube-dl-d35dc344af8ca0b4cc9ea738a290c04842adb9db.zip
[YoutubeDL] Apply expand_path after output template substitution
os.path.expandvars translates '%%' into '%' making output template invalid.
Before: '%%(ext)s' -(expand path)-> '%(ext)s' -(outtmpl subst.)-> 'mp4'
After: '%%(ext)s' -(outtmpl subst.)-> '%(ext)s' -(expand path)-> '%(ext)s'
-rwxr-xr-xyoutube_dl/YoutubeDL.py3
1 files changed, 1 insertions, 2 deletions
diff --git a/youtube_dl/YoutubeDL.py b/youtube_dl/YoutubeDL.py
index 3da5200d7..819b374ef 100755
--- a/youtube_dl/YoutubeDL.py
+++ b/youtube_dl/YoutubeDL.py
@@ -672,8 +672,7 @@ class YoutubeDL(object):
                         FORMAT_RE.format(numeric_field),
                         r'%({0})s'.format(numeric_field), outtmpl)
 
-            tmpl = expand_path(outtmpl)
-            filename = tmpl % template_dict
+            filename = expand_path(outtmpl % template_dict)
             # Temporary fix for #4787
             # 'Treat' all problem characters by passing filename through preferredencoding
             # to workaround encoding issues with subprocess on python2 @ Windows