if we detect a schema change, we must make sure not to update cards
fixes https://anki.tenderapp.com/discussions/ankidesktop/13226-bug-endless-error-report-in-browser
This commit is contained in:
parent
a27847de58
commit
c38b267b2d
@ -63,6 +63,10 @@ class Anki2Importer(Importer):
|
||||
# we may need to rewrite the guid if the model schemas don't match,
|
||||
# so we need to keep track of the changes for the card import stage
|
||||
self._changedGuids = {}
|
||||
# apart from upgrading from anki1 decks, we ignore updates to changed
|
||||
# schemas. we need to note the ignored guids, so we avoid importing
|
||||
# invalid cards
|
||||
self._ignoredGuids = {}
|
||||
# iterate over source collection
|
||||
add = []
|
||||
update = []
|
||||
@ -108,6 +112,7 @@ class Anki2Importer(Importer):
|
||||
self.col.models.get(oldMid)['name'],
|
||||
note[6].replace("\x1f", ",")
|
||||
))
|
||||
self._ignoredGuids[note[GUID]] = True
|
||||
if dupes:
|
||||
up = len(update)
|
||||
self.log.append(_("Updated %(a)d of %(b)d existing notes.") % dict(
|
||||
@ -269,6 +274,8 @@ class Anki2Importer(Importer):
|
||||
guid = card[0]
|
||||
if guid in self._changedGuids:
|
||||
guid = self._changedGuids[guid]
|
||||
if guid in self._ignoredGuids:
|
||||
continue
|
||||
# does the card's note exist in dst col?
|
||||
if guid not in self._notes:
|
||||
continue
|
||||
|
Loading…
Reference in New Issue
Block a user