diff --git a/anki/decks.py b/anki/decks.py index 20d3f038a..4edd8bba4 100644 --- a/anki/decks.py +++ b/anki/decks.py @@ -153,8 +153,16 @@ class DeckManager: # child of an existing deck then it needs to be renamed deck = self.get(did) if '::' in deck['name']: - deck['name'] = _("Default") - self.save(deck) + base = deck['name'].split("::")[-1] + suffix = "" + while True: + # find an unused name + name = base + suffix + if not self.byName(name): + deck['name'] = name + self.save(deck) + break + suffix += "1" return # log the removal regardless of whether we have the deck or not self.col._logRem([did], REM_DECK)