mirror of
https://github.com/ankitects/anki.git
synced 2025-09-25 09:16:38 -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 zipfile
|
||||||
import json
|
import json
|
||||||
import unicodedata
|
import unicodedata
|
||||||
|
import shutil
|
||||||
|
|
||||||
from aqt.qt import *
|
from aqt.qt import *
|
||||||
import anki.importing as importing
|
import anki.importing as importing
|
||||||
|
@ -399,7 +400,9 @@ def _replaceWithApkg(mw, file, backup):
|
||||||
colname = "collection.anki2"
|
colname = "collection.anki2"
|
||||||
|
|
||||||
try:
|
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:
|
except:
|
||||||
mw.progress.finish()
|
mw.progress.finish()
|
||||||
showWarning(_("The provided file is not a valid .apkg file."))
|
showWarning(_("The provided file is not a valid .apkg file."))
|
||||||
|
|
Loading…
Reference in a new issue