From 7895652c76ed918930c4843bcf3f4a9772fa11fe Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 14 Feb 2012 20:14:35 +0530 Subject: [PATCH] When reading metadata from very large HTML files, do not search the entire file for the metadata, as this can be very slow --- src/calibre/ebooks/metadata/html.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/calibre/ebooks/metadata/html.py b/src/calibre/ebooks/metadata/html.py index a2ca76aa54..a8cc6c0eae 100644 --- a/src/calibre/ebooks/metadata/html.py +++ b/src/calibre/ebooks/metadata/html.py @@ -34,6 +34,7 @@ def get_metadata_(src, encoding=None): # Title title = None pat = re.compile(r'', re.DOTALL) + src = src[:150000] # Searching shouldn't take too long match = pat.search(src) if match: title = match.group(2)