diff --git a/vfs/vfs_test.go b/vfs/vfs_test.go index e262e7d2a..980220fdd 100644 --- a/vfs/vfs_test.go +++ b/vfs/vfs_test.go @@ -140,6 +140,7 @@ func TestVFSNew(t *testing.T) { // Check making a VFS with nil options var defaultOpt = vfscommon.DefaultOpt defaultOpt.DirPerms |= os.ModeDir + defaultOpt.LinkPerms |= os.ModeSymlink assert.Equal(t, vfs.Opt, defaultOpt) assert.Equal(t, vfs.f, r.Fremote) diff --git a/vfs/vfscommon/options.go b/vfs/vfscommon/options.go index c5fef88a7..47116a66e 100644 --- a/vfs/vfscommon/options.go +++ b/vfs/vfscommon/options.go @@ -22,6 +22,7 @@ type Options struct { GID uint32 DirPerms os.FileMode FilePerms os.FileMode + LinkPerms os.FileMode ChunkSize fs.SizeSuffix // if > 0 read files in chunks ChunkSizeLimit fs.SizeSuffix // if > ChunkSize double the chunk size after each chunk until reached CacheMode CacheMode @@ -52,6 +53,7 @@ var DefaultOpt = Options{ GID: ^uint32(0), // overridden for non windows in mount_unix.go DirPerms: os.FileMode(0777), FilePerms: os.FileMode(0666), + LinkPerms: os.ModePerm, CacheMode: CacheModeOff, CacheMaxAge: 3600 * time.Second, CachePollInterval: 60 * time.Second, @@ -72,8 +74,12 @@ func (opt *Options) Init() { // Mask the permissions with the umask opt.DirPerms &= ^os.FileMode(opt.Umask) opt.FilePerms &= ^os.FileMode(opt.Umask) + opt.LinkPerms &= ^os.FileMode(opt.Umask) // Make sure directories are returned as directories opt.DirPerms |= os.ModeDir + // Make sure links are returned as links + opt.LinkPerms |= os.ModeSymlink + }