mirror of
https://github.com/mikf/gallery-dl.git
synced 2024-11-22 10:42:34 +01:00
[formatter] use value of last alternative (#4492)
fixes {fieldname|''} evaluating to the value of 'keywords-default' instead of an empty string
This commit is contained in:
parent
f856987297
commit
93a7a89cf6
@ -182,9 +182,10 @@ class StringFormatter():
|
||||
if obj:
|
||||
break
|
||||
except Exception:
|
||||
pass
|
||||
obj = None
|
||||
else:
|
||||
obj = self.default
|
||||
if obj is None:
|
||||
obj = self.default
|
||||
return fmt(obj)
|
||||
return wrap
|
||||
|
||||
|
@ -340,6 +340,8 @@ class TestFormatter(unittest.TestCase):
|
||||
self._run_test("{'foobar'[:3]}", value)
|
||||
self._run_test("{z|'foo'}" , value)
|
||||
self._run_test("{z|''|'foo'}" , value)
|
||||
self._run_test("{z|''}" , "")
|
||||
self._run_test("{''|''}" , "")
|
||||
|
||||
self._run_test("{_lit[foo]}" , value)
|
||||
self._run_test("{_lit[foo]!u}" , value.upper())
|
||||
|
Loading…
Reference in New Issue
Block a user