From 498740a7ad4de37452b47c8fd8475822b041e9c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20D=C3=B6rfelt?= Date: Sun, 23 Jun 2024 15:16:00 +0200 Subject: [PATCH] make sure to search tags in lower case (as they are in Joplin) --- src/importer.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/importer.py b/src/importer.py index d16847a..02f20e7 100644 --- a/src/importer.py +++ b/src/importer.py @@ -29,13 +29,13 @@ def add_tag(self, tag: imf.Tag) -> str | None: self.tag_map[tag.reference_id] = tag_id return tag_id except requests.exceptions.HTTPError: - # Tag exists already. Search for it. - title = tag.data["title"] + # Tag exists already. Search for it. Joplin only supports lower case + # tags. If not converted to lower case, this can cause some trouble. + # See: https://github.com/marph91/jimmy/issues/6#issuecomment-2184981456 + title = tag.data["title"].lower() result = self.api.search(query=title, type="tag") matching_tags = [ - joplin_tag - for joplin_tag in result.items - if joplin_tag.title == title.lower() + joplin_tag for joplin_tag in result.items if joplin_tag.title == title ] if len(matching_tags) == 0: LOGGER.warning(