mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
fix tags with missing leading/trailing spaces in DB check
This commit is contained in:
parent
9645b85df8
commit
ff170bff31
1 changed files with 5 additions and 3 deletions
|
@ -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 a new issue