mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
fix importing of v2 colpkg files
This commit is contained in:
parent
5cd063a8bd
commit
8a15bc897b
1 changed files with 4 additions and 1 deletions
|
@ -8,6 +8,7 @@ import traceback
|
|||
import zipfile
|
||||
import json
|
||||
import unicodedata
|
||||
import shutil
|
||||
|
||||
from aqt.qt import *
|
||||
import anki.importing as importing
|
||||
|
@ -399,7 +400,9 @@ def _replaceWithApkg(mw, file, backup):
|
|||
colname = "collection.anki2"
|
||||
|
||||
try:
|
||||
z.extract(colname, mw.pm.profileFolder())
|
||||
with z.open(colname) as source, \
|
||||
open(mw.pm.collectionPath(), "wb") as target:
|
||||
shutil.copyfileobj(source, target)
|
||||
except:
|
||||
mw.progress.finish()
|
||||
showWarning(_("The provided file is not a valid .apkg file."))
|
||||
|
|
Loading…
Reference in a new issue