fix unnecessary spaces being added to notes with empty tags

This commit is contained in:
Damien Elmes 2020-05-04 21:53:22 +10:00
parent 5236e20a7a
commit 9bb4a02e0a

View file

@ -1010,7 +1010,9 @@ and type=0""",
to_fix = [] to_fix = []
for id, tags in self.db.execute("select id, tags from notes"): for id, tags in self.db.execute("select id, tags from notes"):
norm = unicodedata.normalize("NFC", tags) norm = unicodedata.normalize("NFC", tags)
if not norm.startswith(" ") or not norm.endswith(" "): if not norm.strip():
norm = ""
elif not norm.startswith(" ") or not norm.endswith(" "):
norm = " " + norm + " " norm = " " + norm + " "
if norm != tags: if norm != tags:
to_fix.append((norm, self.usn(), intTime(), id)) to_fix.append((norm, self.usn(), intTime(), id))