A feature-rich command-line audio/video downloader
[outtmpl] Fix some minor bugs
pukkandanebe1b4e34f43
diff --git a/test/test_YoutubeDL.py b/test/test_YoutubeDL.pyindex ee6c527135..ccc9e36f34 100644--- a/test/test_YoutubeDL.py+++ b/test/test_YoutubeDL.py@@ -755,7 +755,7 @@ class TestYoutubeDL(unittest.TestCase):test('%(id)d %(id)r', "1234 '1234'")test('%(id)r %(height)r', "'1234' 1080")test('%(ext)s-%(ext|def)d', 'mp4-def')- test('%(width|0)04d', '0000')+ test('%(width|0)04d', '0')test('a%(width|b)d', 'ab', outtmpl_na_placeholder='none')FORMATS = self.outtmpl_info['formats']diff --git a/yt_dlp/YoutubeDL.py b/yt_dlp/YoutubeDL.pyindex 077a37b305..a546ce65ba 100644--- a/yt_dlp/YoutubeDL.py+++ b/yt_dlp/YoutubeDL.py@@ -1286,17 +1286,17 @@ class YoutubeDL:if fmt == 's' and value is not None and key in field_size_compat_map.keys():fmt = f'0{field_size_compat_map[key]:d}d'- if value is None:- value = default- elif replacement is not None:+ if None not in (value, replacement):try:value = replacement_formatter.format(replacement, value)except ValueError:- value = na+ value, default = None, naflags = outer_mobj.group('conversion') or ''str_fmt = f'{fmt[:-1]}s'- if fmt[-1] == 'l': # list+ if value is None:+ value, fmt = default, 's'+ elif fmt[-1] == 'l': # listdelim = '\n' if '#' in flags else ', 'value, fmt = delim.join(map(str, variadic(value, allowed_types=(str, bytes)))), str_fmtelif fmt[-1] == 'j': # jsondiff --git a/yt_dlp/utils/_utils.py b/yt_dlp/utils/_utils.pyindex 256e2db5a9..d10d621d54 100644--- a/yt_dlp/utils/_utils.py+++ b/yt_dlp/utils/_utils.py@@ -3302,7 +3302,7 @@ STR_FORMAT_RE_TMPL = r'''(?x)'''-STR_FORMAT_TYPES = 'diouxXeEfFgGcrs'+STR_FORMAT_TYPES = 'diouxXeEfFgGcrsa'def limit_length(s, length):