Ignore files for which stat() fails when listing extra files

This commit is contained in:
Kovid Goyal 2023-04-24 22:25:47 +05:30
parent 0b9064bcc6
commit 6a0b6f46de
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -1915,7 +1915,10 @@ class DB:
relpath = os.path.relpath(path, full_book_path) relpath = os.path.relpath(path, full_book_path)
relpath = relpath.replace(os.sep, '/') relpath = relpath.replace(os.sep, '/')
if relpath not in known_files: if relpath not in known_files:
try:
stat_result = os.stat(path) stat_result = os.stat(path)
except OSError:
continue
if stat.S_ISDIR(stat_result.st_mode): if stat.S_ISDIR(stat_result.st_mode):
continue continue
if yield_paths: if yield_paths: