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
This commit is contained in:
parent
f0013ef37d
commit
86dda4e018
1 changed files with 15 additions and 0 deletions
|
@ -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');
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue