www

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

commit 86dda4e0183f6753c89fea4ba5b61cf694439c19
parent f0013ef37d16df4bfc9de37498b225acdf6fec7e
Author: Dan Stillman <dstillman@zotero.org>
Date:   Sat,  3 Mar 2012 05:57:16 -0500

Ignore a file sync error on Windows with long ad junk files

For some reason on some Windows (XP, 7) systems a long path close to 255
characters long can pass destFile.create() and fail zipReader.extract().
This seems like a Mozilla bug, but until we find a better fix just
ignore the error for the only files where we've seen it, which are
advertising script artifacts with very long uninterrupted filenames
(which we should skip when saving anyway).

Also close zipReader after an extraction error

Diffstat:
Mchrome/content/zotero/xpcom/storage.js | 15+++++++++++++++
1 file changed, 15 insertions(+), 0 deletions(-)

diff --git a/chrome/content/zotero/xpcom/storage.js b/chrome/content/zotero/xpcom/storage.js @@ -1111,6 +1111,7 @@ Zotero.Sync.Storage = new function () { Components.utils.reportError(msg + " in " + funcName); continue; } + try { destFile.create(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, 0644); } @@ -1234,6 +1235,20 @@ Zotero.Sync.Storage = new function () { } catch (e) { Zotero.debug(destFile.path); + + // For advertising junk files, ignore a bug on Windows where + // destFile.create() works but zipReader.extract() doesn't + // when the path length is close to 255. + if (destFile.leafName.match(/[a-zA-Z0-9]{130,}/)) { + var msg = "Ignoring error extracting '" + destFile.path + "'"; + Zotero.debug(msg, 2); + Zotero.debug(e, 2); + Components.utils.reportError(msg + " in " + funcName); + continue; + } + + zipReader.close(); + Zotero.File.checkFileAccessError(e, destFile, 'create'); }