TXT Input: Dont fail if the txt file references a directory as a resosource. Fixes #1936184 [Txt conversion => azw3 failed](https://bugs.launchpad.net/calibre/+bug/1936184)

This commit is contained in:
Kovid Goyal 2021-07-14 17:12:29 +05:30
parent 4d61c08281
commit 9efcc37f16
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -116,7 +116,7 @@ class TXTInput(InputFormatPlugin):
prefix = src.split(':', 1)[0].lower() prefix = src.split(':', 1)[0].lower()
if prefix not in ('file', 'http', 'https', 'ftp') and not os.path.isabs(src): if prefix not in ('file', 'http', 'https', 'ftp') and not os.path.isabs(src):
src = os.path.join(base_dir, src) src = os.path.join(base_dir, src)
if os.access(src, os.R_OK): if os.path.isfile(src) and os.access(src, os.R_OK):
with open(src, 'rb') as f: with open(src, 'rb') as f:
data = f.read() data = f.read()
f = self.shift_file(os.path.basename(src), data) f = self.shift_file(os.path.basename(src), data)