www

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

commit c3df3fcebfbe8f775f90502e95a2b8332ad4d60b
parent 2c47b6403d73c862179afaf838b391748781b627
Author: Dan Stillman <dstillman@zotero.org>
Date:   Sat,  2 Dec 2017 03:57:41 -0500

Fix "Access is denied" file sync error with read-only files

If the read-only file is set on a file in the 'storage' directory, it's
added to the ZIP for snapshot/WebDAV syncing, and when extracted the
setDates() call was failing. This clears the read-only attribute (and
system and hidden) when extracting all files.

Diffstat:
Mchrome/content/zotero/xpcom/file.js | 15+++++++++++++++
Mchrome/content/zotero/xpcom/storage/storageLocal.js | 2+-
2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/chrome/content/zotero/xpcom/file.js b/chrome/content/zotero/xpcom/file.js @@ -690,6 +690,21 @@ Zotero.File = new function(){ } + this.setNormalFilePermissions = function (file) { + return OS.File.setPermissions( + file, + { + unixMode: 0o644, + winAttributes: { + readOnly: false, + hidden: false, + system: false + } + } + ); + } + + this.createShortened = function (file, type, mode, maxBytes) { file = this.pathToFile(file); diff --git a/chrome/content/zotero/xpcom/storage/storageLocal.js b/chrome/content/zotero/xpcom/storage/storageLocal.js @@ -932,7 +932,7 @@ Zotero.Sync.Storage.Local = { Zotero.File.checkFileAccessError(e, destPath, 'create'); } - yield OS.File.setPermissions(destPath, { unixMode: 0o644 }); + yield Zotero.File.setNormalFilePermissions(destPath); // If we're renaming the main file, processDownload() needs to know if (renamed) {