commit 73cc7b8707fdd67afb88822f464c4b0e584b3340
parent 20486d505332ba88c91bc816a710eaa0ad7f73b3
Author: Dan Stillman <dstillman@zotero.org>
Date: Fri, 18 Aug 2006 07:06:01 +0000
Fixes #192, double-clicking webpage snapshots sometimes brings up a save dialog
On Simon's suggestion, appending .html to all text/html files--I can't reproduce the problem, and I'm not sure what's causing the ExternalHelperAppService to get confused, but this should at least avoid the issue...
Diffstat:
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
@@ -2049,7 +2049,19 @@ Scholar.Attachments = new function(){
var file = Components.classes["@mozilla.org/file/local;1"].
createInstance(Components.interfaces.nsILocalFile);
file.initWithFile(destDir);
- file.append(_getFileNameFromURL(url, mimeType));
+ var fileName = _getFileNameFromURL(url, mimeType);
+
+ // This is a hack to make sure the file is opened in the browser when
+ // we use loadURI(), since Firefox's internal detection mechanisms seem
+ // to sometimes get confused
+ // (see #192, https://chnm.gmu.edu/trac/scholar/ticket/192)
+ if (mimeType=='text/html' &&
+ (fileName.substr(0, fileName.length-5)!='.html'
+ || fileName.substr(0, fileName.length-4)!='.htm')){
+ fileName += '.html';
+ }
+
+ file.append(fileName);
wbp.saveDocument(document, file, destDir, mimeType, encodingFlags, false);