Content server: Fix reading of books with thousands of internal files not working in the Chrome browser. Fixes #1964742 [Error when opening EPUB file which contains many chapters via Web Interface](https://bugs.launchpad.net/calibre/+bug/1964742)

Apparently chrome's network stack is too dumb to queue multiple ajax
requests so do it in our code.
This commit is contained in:
Kovid Goyal 2022-03-14 20:09:05 +05:30
parent b2950eaeee
commit f8f971d208
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -437,6 +437,11 @@ class ReadUI:
self.downloads_in_progress.remove(xhr)
progress_track[this] = raster_cover_size if this is raster_cover_name else files[this].size
update_progress()
if len(queued):
for fname in queued:
start_download(fname, base_path + encodeURIComponent(fname).replace(/%2[fF]/g, '/'))
queued.discard(fname)
break
if end_type is 'abort':
files_left.discard(this)
return
@ -469,9 +474,15 @@ class ReadUI:
if raster_cover_name:
start_download(raster_cover_name, 'get/cover/' + book_id + '/' + encodeURIComponent(library_id))
count = 0
queued = set()
for fname in files_left:
if fname is not raster_cover_name:
start_download(fname, base_path + encodeURIComponent(fname).replace(/%2[fF]/g, '/'))
count += 1
if count < 20:
start_download(fname, base_path + encodeURIComponent(fname).replace(/%2[fF]/g, '/'))
else:
queued.add(fname)
def ensure_maths(self, proceed):
self.db.get_mathjax_info(def(mathjax_info):