mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 02:34:06 -04:00
Only show the Data files link if there is an actual file in the data folder, ignore sub-folders
This commit is contained in:
parent
6a0b6f46de
commit
79cd85af35
@ -219,8 +219,10 @@ def mi_to_html(
|
|||||||
else:
|
else:
|
||||||
data_path = os.path.join(path, DATA_DIR_NAME)
|
data_path = os.path.join(path, DATA_DIR_NAME)
|
||||||
with suppress(OSError):
|
with suppress(OSError):
|
||||||
if os.listdir(data_path):
|
for de in os.scandir(data_path):
|
||||||
num_of_folders = 2
|
if de.is_file():
|
||||||
|
num_of_folders = 2
|
||||||
|
break
|
||||||
text = _('Book files')
|
text = _('Book files')
|
||||||
name = ngettext('Folder:', 'Folders:', num_of_folders)
|
name = ngettext('Folder:', 'Folders:', num_of_folders)
|
||||||
link = '<a href="{}" title="{}">{}</a>{}'.format(action(scheme, book_id=book_id, loc=loc),
|
link = '<a href="{}" title="{}">{}</a>{}'.format(action(scheme, book_id=book_id, loc=loc),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user