www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit d7990b0e0354bf054eb88e248ca21bb3ac608add
parent 318cf3194f4104f70f0affb4e2eb06400708522f
Author: Dan Stillman <dstillman@zotero.org>
Date:   Wed,  9 Aug 2006 06:32:16 +0000

Updated Scholar.Files.linkFromURL() to take title and mime type as parameters, to prevent loading huge external PDFs just to get the content type when the ingester already knows it (though that will hopefully be alleviated by #173 and #174 later)


Diffstat:
Mchrome/chromeFiles/content/scholar/xpcom/data_access.js | 14+++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/chrome/chromeFiles/content/scholar/xpcom/data_access.js b/chrome/chromeFiles/content/scholar/xpcom/data_access.js @@ -1962,7 +1962,19 @@ Scholar.Files = new function(){ } - function linkFromURL(url, sourceItemID){ + function linkFromURL(url, sourceItemID, title, mimeType){ + // If we're given the title and mime type, don't bother fetching the page + if (title && mimeType){ + _addToDB(null, url, title, this.LINK_MODE_LINKED_URL, mimeType, null, sourceItemID); + return; + } + + // TODO: try to get title and content type without fetching the whole page + // - https://chnm.gmu.edu/trac/scholar/ticket/173 + // (or, failing that, at least check the file size and don't load huge files) + // + // DEBUG: don't load images and other attached files + // - https://chnm.gmu.edu/trac/scholar/ticket/174 var browser = Scholar.Browser.createHiddenBrowser(); browser.addEventListener("pageshow", function(){ Scholar.Files.linkFromDocument(browser.contentDocument, sourceItemID);