"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
vfs: factor out the VFS option initialization for re-use #3259
Nick Craig-Wood626a416ff894
diff --git a/vfs/vfs.go b/vfs/vfs.goindex d220d015e..fc4eb1264 100644--- a/vfs/vfs.go+++ b/vfs/vfs.go@@ -193,12 +193,8 @@ func New(f fs.Fs, opt *vfscommon.Options) *VFS {vfs.Opt = vfscommon.DefaultOpt}- // Mask the permissions with the umask- vfs.Opt.DirPerms &= ^os.FileMode(vfs.Opt.Umask)- vfs.Opt.FilePerms &= ^os.FileMode(vfs.Opt.Umask)-- // Make sure directories are returned as directories- vfs.Opt.DirPerms |= os.ModeDir+ // Fill out anything else+ vfs.Opt.Init()// Find a VFS with the same name and options and return it if possibleactiveMu.Lock()diff --git a/vfs/vfscommon/options.go b/vfs/vfscommon/options.goindex 90cbe5bb7..5c1ae7900 100644--- a/vfs/vfscommon/options.go+++ b/vfs/vfscommon/options.go@@ -62,3 +62,14 @@ var DefaultOpt = Options{ReadAhead: 0 * fs.Mebi,UsedIsSize: false,}++// Init the options, making sure everything is withing range+func (opt *Options) Init() {+ // Mask the permissions with the umask+ opt.DirPerms &= ^os.FileMode(opt.Umask)+ opt.FilePerms &= ^os.FileMode(opt.Umask)++ // Make sure directories are returned as directories+ opt.DirPerms |= os.ModeDir++}