commit bcacb794896d0910ce420da0cfc942ed1e6cff9b
parent deb77cdb083b2bc897692a4ac03a597c59d3144b
Author: Dan Stillman <dstillman@zotero.org>
Date: Sat, 31 Jan 2015 15:22:02 -0500
Fix remote file saving
5f8b56ef8 was so many different kinds of broken
Diffstat:
5 files changed, 24 insertions(+), 21 deletions(-)
diff --git a/chrome/content/zotero/preferences/preferences_search.js b/chrome/content/zotero/preferences/preferences_search.js
@@ -392,7 +392,7 @@ Zotero_Preferences.Search = {
wbp.progressListener = progressListener;
Zotero.debug("Saving " + uri.spec + " to " + fileURL.spec);
- Zotero.Utilities.Internal.saveURI(wbp, nsIURL, file);
+ Zotero.Utilities.Internal.saveURI(wbp, uri, fileURL);
},
diff --git a/chrome/content/zotero/webpagedump/common.js b/chrome/content/zotero/webpagedump/common.js
@@ -672,7 +672,7 @@ var wpdCommon = {
// has the url the same filetype like the file extension?
//save file to target
- Zotero.Utilities.Internal.saveURI(wbp, nsIURL, file);
+ Zotero.Utilities.Internal.saveURI(wbp, obj_URI, obj_TargetFile);
return true;
diff --git a/chrome/content/zotero/xpcom/storage/webdav.js b/chrome/content/zotero/xpcom/storage/webdav.js
@@ -963,7 +963,7 @@ Zotero.Sync.Storage.WebDAV = (function () {
.createInstance(nsIWBP);
wbp.persistFlags = nsIWBP.PERSIST_FLAGS_BYPASS_CACHE;
wbp.progressListener = listener;
- Zotero.Utilities.Internal.saveURI(wbp, nsIURL, file);
+ Zotero.Utilities.Internal.saveURI(wbp, uri, destFile);
return deferred.promise;
});
diff --git a/chrome/content/zotero/xpcom/storage/zfs.js b/chrome/content/zotero/xpcom/storage/zfs.js
@@ -944,7 +944,7 @@ Zotero.Sync.Storage.ZFS = (function () {
.createInstance(nsIWBP);
wbp.persistFlags = nsIWBP.PERSIST_FLAGS_BYPASS_CACHE;
wbp.progressListener = listener;
- Zotero.Utilities.Internal.saveURI(wbp, nsIURL, file);
+ Zotero.Utilities.Internal.saveURI(wbp, uri, destFile);
return deferred.promise;
});
diff --git a/chrome/content/zotero/xpcom/utilities_internal.js b/chrome/content/zotero/xpcom/utilities_internal.js
@@ -266,6 +266,25 @@ Zotero.Utilities.Internal = {
}
},
+
+ /**
+ * saveURI wrapper function
+ * @param {nsIWebBrowserPersist} nsIWebBrowserPersist
+ * @param {nsIURI} source URL
+ * @param {nsISupports} target file
+ */
+ saveURI: function (wbp, source, target) {
+ // Firefox 35 and below
+ try {
+ wbp.saveURI(source, null, null, null, null, target, null);
+ }
+ // Firefox 36+ needs one more parameter
+ catch (e if e.name === "NS_ERROR_XPC_NOT_ENOUGH_ARGS") {
+ wbp.saveURI(source, null, null, null, null, null, target, null);
+ }
+ },
+
+
/**
* Launch a process
* @param {nsIFile} cmd Path to command to launch
@@ -469,21 +488,5 @@ Zotero.Utilities.Internal.Base64 = {
}
return string;
- },
- /**
- * saveURI wrapper function
- * @param {nsIWebBrowserPersist} nsIWebBrowserPersist
- * @param {nsIURI} source URL
- * @param {nsISupports} target file
- */
- saveURI: function (wbp, source, target) {
- // Firefox 35 and below
- try {
- wbp.saveURI(source, null, null, null, null, target, null);
- }
- // Firefox 36+ needs one more parameter
- catch (e if e.name === "NS_ERROR_XPC_NOT_ENOUGH_ARGS") {
- wbp.saveURI(source, null, null, null, null, null, target, null);
- }
- }
+ }
}
\ No newline at end of file