More robust against buggy FileType plugins on book import

This commit is contained in:
Kovid Goyal 2014-12-05 18:54:26 +05:30
parent 2791ba0332
commit 54909e3a59

View File

@ -36,7 +36,12 @@ def run_import_plugins(paths, group_id, tdir):
for path in paths: for path in paths:
if not os.access(path, os.R_OK): if not os.access(path, os.R_OK):
continue continue
try:
nfp = run_plugins_on_import(path) nfp = run_plugins_on_import(path)
except Exception:
nfp = None
import traceback
traceback.print_exc()
if nfp and os.access(nfp, os.R_OK) and not samefile(nfp, path): if nfp and os.access(nfp, os.R_OK) and not samefile(nfp, path):
# Ensure that the filename is preserved so that # Ensure that the filename is preserved so that
# reading metadata from filename is not broken # reading metadata from filename is not broken