aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--youtube_dl/utils.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py
index f07679c76..b3abfbc11 100644
--- a/youtube_dl/utils.py
+++ b/youtube_dl/utils.py
@@ -1349,9 +1349,12 @@ def parse_duration(s):
return res
-def prepend_extension(filename, ext):
+def prepend_extension(filename, ext, expected_real_ext=None):
name, real_ext = os.path.splitext(filename)
- return '{0}.{1}{2}'.format(name, ext, real_ext)
+ return (
+ '{0}.{1}{2}'.format(name, ext, real_ext)
+ if not expected_real_ext or real_ext[1:] == expected_real_ext
+ else '{0}.{1}'.format(filename, ext))
def check_executable(exe, args=[]):