www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 3941dd911a1b7ec7e3cd66a7e2abf171faf53665
parent 38459c5d0ecf5c89e56ed81ea06112c01e7e5dad
Author: Dan Stillman <dstillman@zotero.org>
Date:   Sun, 27 Sep 2009 07:40:39 +0000

Fix potential cause of "Downloaded file not found in Zotero.Sync.Storage.processDownload()"


Diffstat:
Mchrome/content/zotero/xpcom/storage/zfs.js | 13+++++--------
1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/chrome/content/zotero/xpcom/storage/zfs.js b/chrome/content/zotero/xpcom/storage/zfs.js @@ -189,13 +189,10 @@ Zotero.Sync.Storage.Session.ZFS.prototype.downloadFile = function (request) { } else { destFile.append(item.key + '.tmp'); - if (destFile.exists()) { - destFile.remove(false); - } - } - if (destFile.exists()) { - destFile.remove(false); } + // saveURI() below appears not to create empty files for Content-Length: 0, + // so we create one here just in case + destFile.create(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, 0644); var listener = new Zotero.Sync.Storage.StreamListener( { @@ -255,8 +252,8 @@ Zotero.Sync.Storage.Session.ZFS.prototype.downloadFile = function (request) { var wbp = Components .classes["@mozilla.org/embedding/browser/nsWebBrowserPersist;1"] .createInstance(nsIWBP); - wbp.persistFlags = nsIWBP.PERSIST_FLAGS_BYPASS_CACHE; - + wbp.persistFlags = nsIWBP.PERSIST_FLAGS_BYPASS_CACHE + | nsIWBP.PERSIST_FLAGS_REPLACE_EXISTING_FILES; wbp.progressListener = listener; wbp.saveURI(uri, null, null, null, null, destFile); }