Don't do doHead if MIME type already set in Zotero.Attachments.linkFromURL()
This commit is contained in:
parent
898890eca3
commit
db89785a8a
|
@ -382,17 +382,19 @@ Zotero.Attachments = new function(){
|
|||
Zotero.Notifier.enable();
|
||||
}
|
||||
|
||||
// If we don't have the MIME type, do a HEAD request for it
|
||||
Zotero.Utilities.HTTP.doHead(url, function(obj){
|
||||
var mimeType = obj.channel.contentType;
|
||||
|
||||
if (mimeType) {
|
||||
var sql = "UPDATE itemAttachments SET mimeType=? WHERE itemID=?";
|
||||
Zotero.DB.query(sql, [mimeType, itemID]);
|
||||
}
|
||||
|
||||
Zotero.Notifier.trigger('add', 'item', itemID);
|
||||
});
|
||||
if (!mimeType) {
|
||||
// If we don't have the MIME type, do a HEAD request for it
|
||||
Zotero.Utilities.HTTP.doHead(url, function(obj){
|
||||
var mimeType = obj.channel.contentType;
|
||||
|
||||
if (mimeType) {
|
||||
var sql = "UPDATE itemAttachments SET mimeType=? WHERE itemID=?";
|
||||
Zotero.DB.query(sql, [mimeType, itemID]);
|
||||
}
|
||||
|
||||
Zotero.Notifier.trigger('add', 'item', itemID);
|
||||
});
|
||||
}
|
||||
|
||||
return itemID;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user