mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Workaround for windows limitation when reading from network sockets. Should fix issues with large files in calibre libraries on network shares. Fixes #3248 (exception on saving book details)
This commit is contained in:
parent
b09e819422
commit
b00e241477
@ -721,7 +721,13 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns):
|
|||||||
path = self.format_abspath(index, format, index_is_id=index_is_id)
|
path = self.format_abspath(index, format, index_is_id=index_is_id)
|
||||||
if path is not None:
|
if path is not None:
|
||||||
f = open(path, mode)
|
f = open(path, mode)
|
||||||
ret = f if as_file else f.read()
|
try:
|
||||||
|
ret = f if as_file else f.read()
|
||||||
|
except IOError:
|
||||||
|
f.seek(0)
|
||||||
|
out = cStringIO.StringIO()
|
||||||
|
shutil.copyfileobj(f, out)
|
||||||
|
ret = out.getvalue()
|
||||||
if not as_file:
|
if not as_file:
|
||||||
f.close()
|
f.close()
|
||||||
return ret
|
return ret
|
||||||
|
@ -123,8 +123,6 @@ class ContentServer(object):
|
|||||||
|
|
||||||
return self.static('index.html')
|
return self.static('index.html')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Actually get content from the database {{{
|
# Actually get content from the database {{{
|
||||||
def get_cover(self, id, thumbnail=False):
|
def get_cover(self, id, thumbnail=False):
|
||||||
cover = self.db.cover(id, index_is_id=True, as_file=False)
|
cover = self.db.cover(id, index_is_id=True, as_file=False)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user