"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
local: fix update of hidden files on Windows - fixes #3839
Nick Craig-Wood540fd3f173d4
diff --git a/backend/local/local.go b/backend/local/local.goindex 12e52b31d..e67443e07 100644--- a/backend/local/local.go+++ b/backend/local/local.go@@ -956,7 +956,17 @@ func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, opif !o.translatedLink {f, err := file.OpenFile(o.path, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0666)if err != nil {- return err+ if runtime.GOOS == "windows" && os.IsPermission(err) {+ // If permission denied on Windows might be trying to update a+ // hidden file, in which case try opening without CREATE+ // See: https://stackoverflow.com/questions/13215716/ioerror-errno-13-permission-denied-when-trying-to-open-hidden-file-in-w-mod+ f, err = file.OpenFile(o.path, os.O_WRONLY|os.O_TRUNC, 0666)+ if err != nil {+ return err+ }+ } else {+ return err+ }}// Pre-allocate the file for performance reasonserr = preAllocate(src.Size(), f)