diff --git a/anki/notes.py b/anki/notes.py index 0562a5157..5ca8dea9e 100644 --- a/anki/notes.py +++ b/anki/notes.py @@ -3,7 +3,7 @@ # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html from anki.utils import fieldChecksum, intTime, \ - joinFields, splitFields, stripHTML, timestampID, guid64 + joinFields, splitFields, stripHTMLMedia, timestampID, guid64 class Note(object): @@ -47,7 +47,7 @@ from notes where id = ?""", self.id) self._preFlush() self.mod = mod if mod else intTime() self.usn = self.col.usn() - sfld = stripHTML(self.fields[self.col.models.sortIdx(self._model)]) + sfld = stripHTMLMedia(self.fields[self.col.models.sortIdx(self._model)]) tags = self.stringTags() csum = fieldChecksum(self.fields[0]) res = self.col.db.execute(""" @@ -134,7 +134,8 @@ 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 stripHTML(splitFields(flds)[0]) == stripHTML(self.fields[0]): + if stripHTMLMedia( + splitFields(flds)[0]) == stripHTMLMedia(self.fields[0]): return 2 return False diff --git a/anki/utils.py b/anki/utils.py index 94d2920b0..e4209f190 100644 --- a/anki/utils.py +++ b/anki/utils.py @@ -244,7 +244,7 @@ def checksum(data): def fieldChecksum(data): # 32 bit unsigned number from first 8 digits of sha1 hash - return int(checksum(stripHTML(data).encode("utf-8"))[:8], 16) + return int(checksum(stripHTMLMedia(data).encode("utf-8"))[:8], 16) # Temp files ##############################################################################