1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2025-10-30 14:15:13 +00:00

Expand and escape environment variables correctly in outtmpl

Fixes: https://www.reddit.com/r/youtubedl/comments/otfmq3/ytdlp_same_parameters_different_results
This commit is contained in:
pukkandan
2021-07-29 05:19:26 +05:30
parent c0bc527bca
commit 901130bbcf
5 changed files with 60 additions and 37 deletions

View File

@@ -4438,8 +4438,8 @@ OUTTMPL_TYPES = {
# As of [1] format syntax is:
# %[mapping_key][conversion_flags][minimum_width][.precision][length_modifier]type
# 1. https://docs.python.org/2/library/stdtypes.html#string-formatting
STR_FORMAT_RE = r'''(?x)
(?<!%)
STR_FORMAT_RE_TMPL = r'''(?x)
(?<!%)(?P<prefix>(?:%%)*)
%
(?P<has_key>\((?P<key>{0})\))? # mapping key
(?P<format>
@@ -4447,10 +4447,11 @@ STR_FORMAT_RE = r'''(?x)
(?:\d+)? # minimum field width (optional)
(?:\.\d+)? # precision (optional)
[hlL]? # length modifier (optional)
[diouxXeEfFgGcrs] # conversion type
{1} # conversion type
)
'''
STR_FORMAT_TYPES = 'diouxXeEfFgGcrs'
def limit_length(s, length):
""" Add ellipses to overly long strings """