mirror of
https://github.com/zotero/zotero.git
synced 2026-10-05 02:43:38 +00:00
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:
parent
318cf3194f
commit
d7990b0e03
1 changed files with 13 additions and 1 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue