Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed

- `compute_tags` no longer returns an empty tag for whitespace-only values (#412)

## [5.6.0] - 2026-11-20

### Added
Expand Down
5 changes: 2 additions & 3 deletions src/zimscraperlib/inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,8 @@ def compute_tags(
Returns a set of tags, ready to be passed to the creator
"""

return {
tag.strip() for tag in list(default_tags) + (user_tags or "").split(";") if tag
}
tags = (tag.strip() for tag in list(default_tags) + (user_tags or "").split(";"))
return {tag for tag in tags if tag}


def unique_values[T](items: list[T]) -> list[T]:
Expand Down
6 changes: 6 additions & 0 deletions tests/inputs/test_inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,12 @@ def test_description(
{"tag1", "tag2", "ta:g,4"},
id="case2",
),
pytest.param(
{"tag1", " "},
"tag2; ;tag3; ",
{"tag1", "tag2", "tag3"},
id="whitespace_only",
),
],
)
def test_compute_tags(
Expand Down