mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix a regression that broke the conversion of files that contain very long passages of text (more than 100MB worth). Fixes #809501 (memory error during e-book conversion)
This commit is contained in:
parent
f0fdbab3ec
commit
928ba3bc1b
@ -38,8 +38,12 @@ ENCODING_PATS = [
|
|||||||
ENTITY_PATTERN = re.compile(r'&(\S+?);')
|
ENTITY_PATTERN = re.compile(r'&(\S+?);')
|
||||||
|
|
||||||
def strip_encoding_declarations(raw):
|
def strip_encoding_declarations(raw):
|
||||||
|
limit = 50*1024
|
||||||
for pat in ENCODING_PATS:
|
for pat in ENCODING_PATS:
|
||||||
raw = pat.sub('', raw)
|
prefix = raw[:limit]
|
||||||
|
suffix = raw[limit:]
|
||||||
|
prefix = pat.sub('', prefix)
|
||||||
|
raw = prefix + suffix
|
||||||
return raw
|
return raw
|
||||||
|
|
||||||
def substitute_entites(raw):
|
def substitute_entites(raw):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user