set a limit on the number of lines used for detect in Bookmarks.js, so that it doesn't break large file import

at some point, this should probably be changed to read a fixed number of bytes
This commit is contained in:
Simon Kornblith 2011-03-16 23:27:05 +00:00
parent ae1e82494d
commit d8ecaec6e4

View file

@ -8,7 +8,7 @@
"maxVersion":"",
"priority":100,
"inRepository":true,
"lastUpdated":"2011-02-10 04:31:00"
"lastUpdated":"2011-03-16 23:24:54"
}
/*
@ -48,13 +48,15 @@
</DL>
*/
const MAX_DETECT_LINES = 150;
function detectImport() {
var text = "";
var line;
var match;
var re = /<DT>\s*<A[^>]*HREF="([^"]+)"[^>]*>([^<\n]+)/gi;
while((line = Zotero.read()) !== false) {
var i = 0;
while((line = Zotero.read()) !== false && (i++ < MAX_DETECT_LINES)) {
text += line;
match = re.exec(text);
if (match) {