mirror of
https://github.com/sissbruecker/linkding.git
synced 2025-08-14 14:09:26 +02:00
Ignore tags with just whitespace (#1125)
This commit is contained in:
@@ -40,7 +40,7 @@ def parse_tag_string(tag_string: str, delimiter: str = ","):
|
||||
return []
|
||||
names = tag_string.strip().split(delimiter)
|
||||
# remove empty names, sanitize remaining names
|
||||
names = [sanitize_tag_name(name) for name in names if name]
|
||||
names = [sanitize_tag_name(name) for name in names if name.strip()]
|
||||
# remove duplicates
|
||||
names = unique(names, str.lower)
|
||||
names.sort(key=str.lower)
|
||||
|
@@ -41,6 +41,11 @@ class TagTestCase(TestCase):
|
||||
parse_tag_string("book,,movie,,,album"), ["album", "book", "movie"]
|
||||
)
|
||||
|
||||
def test_parse_tag_string_handles_duplicate_separators_with_spaces(self):
|
||||
self.assertCountEqual(
|
||||
parse_tag_string("book, ,movie, , ,album"), ["album", "book", "movie"]
|
||||
)
|
||||
|
||||
def test_parse_tag_string_replaces_whitespace_within_names(self):
|
||||
self.assertCountEqual(
|
||||
parse_tag_string("travel guide, book recommendations"),
|
||||
|
Reference in New Issue
Block a user