From 2dc7a29af09ff8bae3182e1eddcd5d71b57ef560 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Tue, 12 Dec 2006 20:06:13 +0000 Subject: [PATCH] Closes #436, ability to force title when using Zotero.Attachments.importFromURL() --- chrome/content/zotero/xpcom/attachments.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/chrome/content/zotero/xpcom/attachments.js b/chrome/content/zotero/xpcom/attachments.js index 3f46ff3f8..ef783fbd6 100644 --- a/chrome/content/zotero/xpcom/attachments.js +++ b/chrome/content/zotero/xpcom/attachments.js @@ -167,7 +167,7 @@ Zotero.Attachments = new function(){ } - function importFromURL(url, sourceItemID){ + function importFromURL(url, sourceItemID, forceTitle){ Zotero.debug('Importing attachment from URL'); Zotero.Utilities.HTTP.doHead(url, function(obj){ @@ -183,7 +183,7 @@ Zotero.Attachments = new function(){ if (Zotero.MIME.hasNativeHandler(mimeType, ext)){ var browser = Zotero.Browser.createHiddenBrowser(); browser.addEventListener("pageshow", function(){ - Zotero.Attachments.importFromDocument(browser.contentDocument, sourceItemID); + Zotero.Attachments.importFromDocument(browser.contentDocument, sourceItemID, forceTitle); browser.removeEventListener("pageshow", arguments.callee, true); Zotero.Browser.deleteHiddenBrowser(browser); }, true); @@ -193,7 +193,7 @@ Zotero.Attachments = new function(){ // Otherwise use a remote web page persist else { var fileName = _getFileNameFromURL(url, mimeType); - var title = fileName; + var title = forceTitle ? forceTitle : fileName; const nsIWBP = Components.interfaces.nsIWebBrowserPersist; var wbp = Components