mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Dont list directories in list_extra_files()
This commit is contained in:
parent
27bb04c2bd
commit
0b9064bcc6
@ -12,6 +12,7 @@ import hashlib
|
||||
import json
|
||||
import os
|
||||
import shutil
|
||||
import stat
|
||||
import sys
|
||||
import time
|
||||
import uuid
|
||||
@ -1914,9 +1915,11 @@ class DB:
|
||||
relpath = os.path.relpath(path, full_book_path)
|
||||
relpath = relpath.replace(os.sep, '/')
|
||||
if relpath not in known_files:
|
||||
stat = os.stat(path)
|
||||
stat_result = os.stat(path)
|
||||
if stat.S_ISDIR(stat_result.st_mode):
|
||||
continue
|
||||
if yield_paths:
|
||||
yield relpath, path, stat
|
||||
yield relpath, path, stat_result
|
||||
else:
|
||||
try:
|
||||
src = open(path, 'rb')
|
||||
@ -1925,7 +1928,7 @@ class DB:
|
||||
time.sleep(1)
|
||||
src = open(path, 'rb')
|
||||
with src:
|
||||
yield relpath, src, stat
|
||||
yield relpath, src, stat_result
|
||||
|
||||
def add_extra_file(self, relpath, stream, book_path, replace=True, auto_rename=False):
|
||||
bookdir = os.path.join(self.library_path, book_path)
|
||||
|
Loading…
x
Reference in New Issue
Block a user