Skip to content

Commit

Permalink
[pp:metadata] ignore non-string tag values (#4764)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikf committed Nov 4, 2023
1 parent 61d6558 commit 6402f29
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion gallery_dl/postprocessor/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def _write_tags(self, fp, kwdict):
tags = []
extend = tags.extend
for tagdict in taglists:
extend([x for x in tagdict.values() if x is not None])
extend([x for x in tagdict.values() if isinstance(x, str)])
tags.sort()

fp.write("\n".join(tags) + "\n")
Expand Down
4 changes: 2 additions & 2 deletions test/test_postprocessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,8 +365,8 @@ def test_metadata_tags_list_of_dict(self):
self._create(
{"mode": "tags"},
{"tags": [
{"g": "foobar1", "m": "foobar2"},
{"g": None, "m": "foobarbaz"}
{"g": "foobar1", "m": "foobar2", "u": True},
{"g": None, "m": "foobarbaz", "u": [3, 4]},
]},
)
with patch("builtins.open", mock_open()) as m:
Expand Down

0 comments on commit 6402f29

Please sign in to comment.