mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
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:
parent
b2950eaeee
commit
f8f971d208
@ -437,6 +437,11 @@ class ReadUI:
|
|||||||
self.downloads_in_progress.remove(xhr)
|
self.downloads_in_progress.remove(xhr)
|
||||||
progress_track[this] = raster_cover_size if this is raster_cover_name else files[this].size
|
progress_track[this] = raster_cover_size if this is raster_cover_name else files[this].size
|
||||||
update_progress()
|
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':
|
if end_type is 'abort':
|
||||||
files_left.discard(this)
|
files_left.discard(this)
|
||||||
return
|
return
|
||||||
@ -469,9 +474,15 @@ class ReadUI:
|
|||||||
if raster_cover_name:
|
if raster_cover_name:
|
||||||
start_download(raster_cover_name, 'get/cover/' + book_id + '/' + encodeURIComponent(library_id))
|
start_download(raster_cover_name, 'get/cover/' + book_id + '/' + encodeURIComponent(library_id))
|
||||||
|
|
||||||
|
count = 0
|
||||||
|
queued = set()
|
||||||
for fname in files_left:
|
for fname in files_left:
|
||||||
if fname is not raster_cover_name:
|
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):
|
def ensure_maths(self, proceed):
|
||||||
self.db.get_mathjax_info(def(mathjax_info):
|
self.db.get_mathjax_info(def(mathjax_info):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user