fix tags with missing leading/trailing spaces in DB check
This commit is contained in:
parent
9645b85df8
commit
ff170bff31
@ -1009,9 +1009,11 @@ and type=0""",
|
|||||||
def _normalize_tags(self) -> int:
|
def _normalize_tags(self) -> int:
|
||||||
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"):
|
||||||
nfc = unicodedata.normalize("NFC", tags)
|
norm = unicodedata.normalize("NFC", tags)
|
||||||
if nfc != tags:
|
if not norm.startswith(" ") or not norm.endswith(" "):
|
||||||
to_fix.append((nfc, self.usn(), intTime(), id))
|
norm = " " + norm + " "
|
||||||
|
if norm != tags:
|
||||||
|
to_fix.append((norm, self.usn(), intTime(), id))
|
||||||
if to_fix:
|
if to_fix:
|
||||||
self.db.executemany(
|
self.db.executemany(
|
||||||
"update notes set tags=?, usn=?, mod=? where id=?", to_fix
|
"update notes set tags=?, usn=?, mod=? where id=?", to_fix
|
||||||
|
Loading…
Reference in New Issue
Block a user