fix bug caused by user creating profile with trailing space

Caught exception:
  File "aqt\main.py", line 237, in onOpenBackup
  File "aqt\profiles.py", line 264, in backupFolder
  File "aqt\profiles.py", line 274, in _ensureExists
  File "os.py", line 220, in makedirs
<class 'FileNotFoundError'>: [WinError 3] The system cannot find the path specified: 'C:\\Users\\xxx\\AppData\\Roaming\\Anki2\\xxx \\backups'
This commit is contained in:
Damien Elmes 2019-04-25 09:37:58 +10:00
parent ed0fae3c0c
commit b2cfba367e

View File

@ -189,9 +189,8 @@ class AnkiQt(QMainWindow):
return not checkInvalidFilename(str) return not checkInvalidFilename(str)
def onAddProfile(self): def onAddProfile(self):
name = getOnlyText(_("Name:")) name = getOnlyText(_("Name:")).strip()
if name: if name:
name = name.strip()
if name in self.pm.profiles(): if name in self.pm.profiles():
return showWarning(_("Name exists.")) return showWarning(_("Name exists."))
if not self.profileNameOk(name): if not self.profileNameOk(name):
@ -201,7 +200,7 @@ class AnkiQt(QMainWindow):
self.refreshProfilesList() self.refreshProfilesList()
def onRenameProfile(self): def onRenameProfile(self):
name = getOnlyText(_("New name:"), default=self.pm.name) name = getOnlyText(_("New name:"), default=self.pm.name).strip()
if not name: if not name:
return return
if name == self.pm.name: if name == self.pm.name: