more helpful error message for corrupt collection package
This commit is contained in:
parent
8620b81817
commit
ebcab2122d
@ -379,7 +379,11 @@ def replaceWithApkg(mw, file, backup):
|
||||
mw.unloadCollection()
|
||||
# overwrite collection
|
||||
z = zipfile.ZipFile(file)
|
||||
z.extract("collection.anki2", mw.pm.profileFolder())
|
||||
try:
|
||||
z.extract("collection.anki2", mw.pm.profileFolder())
|
||||
except:
|
||||
showWarning(_("The provided file is not a valid .apkg file."))
|
||||
return
|
||||
# because users don't have a backup of media, it's safer to import new
|
||||
# data and rely on them running a media db check to get rid of any
|
||||
# unwanted media. in the future we might also want to deduplicate this
|
||||
|
Loading…
Reference in New Issue
Block a user