Fix file sync errors with symlinked files/directories

nsIFile seems to have figured out symlinks since Firefox 3.0.1
This commit is contained in:
Dan Stillman 2015-04-03 23:59:32 -04:00
parent 788f92bc8b
commit 58b56abbc7

View file

@ -1734,16 +1734,6 @@ Zotero.Sync.Storage = new function () {
Zotero.File.checkFileAccessError(e, destFile, 'create');
}
var origPath = destFile.path;
var origFileName = destFile.leafName;
destFile.normalize();
if (origPath != destFile.path) {
var msg = "ZIP file " + zipFile.leafName + " contained symlink '"
+ origFileName + "'";
Zotero.debug(msg, 1);
Components.utils.reportError(msg + " in " + funcName);
continue;
}
destFile.permissions = 0644;
// If we're renaming the main file, processDownload() needs to know
@ -1773,18 +1763,7 @@ Zotero.Sync.Storage = new function () {
continue;
}
// Firefox (as of 3.0.1) can't detect symlinks (at least on OS X),
// so use pre/post-normalized path to check
var origPath = file.path;
var origFileName = file.leafName;
file.normalize();
if (origPath != file.path) {
var msg = "Not deleting symlink '" + origFileName + "'";
Zotero.debug(msg, 2);
Components.utils.reportError(msg + " in " + funcName);
continue;
}
// This should be redundant with above check, but let's do it anyway
// Check symlink awareness, just to be safe
if (!parentDir.contains(file, false)) {
var msg = "Storage directory doesn't contain '" + file.leafName + "'";
Zotero.debug(msg, 2);