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)

This commit is contained in:
Dan Stillman 2006-08-09 06:32:16 +00:00
parent 318cf3194f
commit d7990b0e03

View file

@ -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);