This commit is contained in:
Kovid Goyal 2024-04-21 08:27:42 +05:30
parent 2585745fde
commit d6b602a085
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -3453,9 +3453,8 @@ def import_library(library_key, importer, library_path, progress=None, abort=Non
if abort is not None and abort.is_set():
return
with open(os.path.join(library_path, 'metadata.db'), 'wb') as f:
src = importer.start_file(metadata['metadata.db'], 'metadata.db for ' + library_path)
shutil.copyfileobj(src, f)
src.close()
with closing(importer.start_file(metadata['metadata.db'], 'metadata.db for ' + library_path)) as src:
shutil.copyfileobj(src, f)
if 'full-text-search.db' in metadata:
if progress is not None:
progress('full-text-search.db', 1, total)
@ -3463,9 +3462,8 @@ def import_library(library_key, importer, library_path, progress=None, abort=Non
return
poff += 1
with open(os.path.join(library_path, 'full-text-search.db'), 'wb') as f:
src = importer.start_file(metadata['full-text-search.db'], 'full-text-search.db for ' + library_path)
shutil.copyfileobj(src, f)
src.close()
with closing(importer.start_file(metadata['full-text-search.db'], 'full-text-search.db for ' + library_path)) as src:
shutil.copyfileobj(src, f)
if abort is not None and abort.is_set():
return
if 'notes.db' in metadata: