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.
This commit is contained in:
parent
2c47b6403d
commit
c3df3fcebf
2 changed files with 16 additions and 1 deletions
|
@ -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);
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue