mirror of
https://github.com/rclone/rclone.git
synced 2024-12-22 23:22:08 +01:00
vfs: Add link permissions
This commit is contained in:
parent
0801342108
commit
8323727d19
@ -140,6 +140,7 @@ func TestVFSNew(t *testing.T) {
|
|||||||
// Check making a VFS with nil options
|
// Check making a VFS with nil options
|
||||||
var defaultOpt = vfscommon.DefaultOpt
|
var defaultOpt = vfscommon.DefaultOpt
|
||||||
defaultOpt.DirPerms |= os.ModeDir
|
defaultOpt.DirPerms |= os.ModeDir
|
||||||
|
defaultOpt.LinkPerms |= os.ModeSymlink
|
||||||
assert.Equal(t, vfs.Opt, defaultOpt)
|
assert.Equal(t, vfs.Opt, defaultOpt)
|
||||||
assert.Equal(t, vfs.f, r.Fremote)
|
assert.Equal(t, vfs.f, r.Fremote)
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@ type Options struct {
|
|||||||
GID uint32
|
GID uint32
|
||||||
DirPerms os.FileMode
|
DirPerms os.FileMode
|
||||||
FilePerms os.FileMode
|
FilePerms os.FileMode
|
||||||
|
LinkPerms os.FileMode
|
||||||
ChunkSize fs.SizeSuffix // if > 0 read files in chunks
|
ChunkSize fs.SizeSuffix // if > 0 read files in chunks
|
||||||
ChunkSizeLimit fs.SizeSuffix // if > ChunkSize double the chunk size after each chunk until reached
|
ChunkSizeLimit fs.SizeSuffix // if > ChunkSize double the chunk size after each chunk until reached
|
||||||
CacheMode CacheMode
|
CacheMode CacheMode
|
||||||
@ -52,6 +53,7 @@ var DefaultOpt = Options{
|
|||||||
GID: ^uint32(0), // overridden for non windows in mount_unix.go
|
GID: ^uint32(0), // overridden for non windows in mount_unix.go
|
||||||
DirPerms: os.FileMode(0777),
|
DirPerms: os.FileMode(0777),
|
||||||
FilePerms: os.FileMode(0666),
|
FilePerms: os.FileMode(0666),
|
||||||
|
LinkPerms: os.ModePerm,
|
||||||
CacheMode: CacheModeOff,
|
CacheMode: CacheModeOff,
|
||||||
CacheMaxAge: 3600 * time.Second,
|
CacheMaxAge: 3600 * time.Second,
|
||||||
CachePollInterval: 60 * time.Second,
|
CachePollInterval: 60 * time.Second,
|
||||||
@ -72,8 +74,12 @@ func (opt *Options) Init() {
|
|||||||
// Mask the permissions with the umask
|
// Mask the permissions with the umask
|
||||||
opt.DirPerms &= ^os.FileMode(opt.Umask)
|
opt.DirPerms &= ^os.FileMode(opt.Umask)
|
||||||
opt.FilePerms &= ^os.FileMode(opt.Umask)
|
opt.FilePerms &= ^os.FileMode(opt.Umask)
|
||||||
|
opt.LinkPerms &= ^os.FileMode(opt.Umask)
|
||||||
|
|
||||||
// Make sure directories are returned as directories
|
// Make sure directories are returned as directories
|
||||||
opt.DirPerms |= os.ModeDir
|
opt.DirPerms |= os.ModeDir
|
||||||
|
|
||||||
|
// Make sure links are returned as links
|
||||||
|
opt.LinkPerms |= os.ModeSymlink
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user