mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Check to see that the result file from a conversion is not empty before adding it, protects against the case where the conversion process crashes and the GUI adds a zero byte file to the book record
This commit is contained in:
parent
a67f9a4e2b
commit
f44bd59b35
@ -165,6 +165,11 @@ class ConvertAction(InterfaceAction):
|
|||||||
if job.failed:
|
if job.failed:
|
||||||
self.gui.job_exception(job)
|
self.gui.job_exception(job)
|
||||||
return
|
return
|
||||||
|
fmtf = temp_files[-1].name
|
||||||
|
if os.stat(fmtf).st_size < 1:
|
||||||
|
raise Exception(_('Empty output file, '
|
||||||
|
'probably the conversion process crashed'))
|
||||||
|
|
||||||
data = open(temp_files[-1].name, 'rb')
|
data = open(temp_files[-1].name, 'rb')
|
||||||
self.gui.library_view.model().db.add_format(book_id, \
|
self.gui.library_view.model().db.add_format(book_id, \
|
||||||
fmt, data, index_is_id=True)
|
fmt, data, index_is_id=True)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user