diff --git a/anki/importing/anki2.py b/anki/importing/anki2.py index 4c3c404c2..e4cc5d112 100644 --- a/anki/importing/anki2.py +++ b/anki/importing/anki2.py @@ -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