mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00
strip HTML when calculating field checksum (users will need to checkDB)
This commit is contained in:
parent
f6ff63eeb8
commit
2095e5c4b3
3 changed files with 4 additions and 4 deletions
|
@ -4,7 +4,7 @@
|
|||
|
||||
import copy, re
|
||||
from anki.utils import intTime, hexifyID, joinFields, splitFields, ids2str, \
|
||||
timestampID, fieldChecksum, json
|
||||
timestampID, checksum, json
|
||||
from anki.lang import _
|
||||
from anki.consts import *
|
||||
from anki.hooks import runHook
|
||||
|
@ -456,7 +456,7 @@ select id from notes where mid = ?)""" % " ".join(map),
|
|||
s += t['name']
|
||||
s += t['qfmt']
|
||||
s += t['afmt']
|
||||
return fieldChecksum(s)
|
||||
return checksum(s)
|
||||
|
||||
# Required field/text cache
|
||||
##########################################################################
|
||||
|
|
|
@ -136,7 +136,7 @@ insert or replace into notes values (?,?,?,?,?,?,?,?,?,?,?)""",
|
|||
for flds in self.col.db.list(
|
||||
"select flds from notes where csum = ? and id != ? and mid = ?",
|
||||
csum, self.id or 0, self.mid):
|
||||
if splitFields(flds)[0] == self.fields[0]:
|
||||
if stripHTML(splitFields(flds)[0]) == stripHTML(self.fields[0]):
|
||||
return 2
|
||||
return False
|
||||
|
||||
|
|
|
@ -245,7 +245,7 @@ def checksum(data):
|
|||
|
||||
def fieldChecksum(data):
|
||||
# 32 bit unsigned number from first 8 digits of sha1 hash
|
||||
return int(checksum(data.encode("utf-8"))[:8], 16)
|
||||
return int(checksum(stripHTML(data).encode("utf-8"))[:8], 16)
|
||||
|
||||
# Temp files
|
||||
##############################################################################
|
||||
|
|
Loading…
Reference in a new issue