From 814f5022b1330d8a5deae617f518976cce06407d Mon Sep 17 00:00:00 2001 From: Nicola Murino Date: Sun, 15 Dec 2024 09:59:06 +0100 Subject: [PATCH] set stat: remove unecessary check Signed-off-by: Nicola Murino --- internal/common/connection.go | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/internal/common/connection.go b/internal/common/connection.go index d3b613c0..f95d0a0e 100644 --- a/internal/common/connection.go +++ b/internal/common/connection.go @@ -922,16 +922,6 @@ func (c *BaseConnection) CreateSymlink(virtualSourcePath, virtualTargetPath stri return nil } -func (c *BaseConnection) getPathForSetStatPerms(fs vfs.Fs, fsPath, virtualPath string) string { - pathForPerms := virtualPath - if fi, err := fs.Lstat(fsPath); err == nil { - if fi.IsDir() { - pathForPerms = path.Dir(virtualPath) - } - } - return pathForPerms -} - func (c *BaseConnection) doStatInternal(virtualPath string, mode int, checkFilePatterns, convertResult bool, ) (os.FileInfo, error) { @@ -1068,7 +1058,7 @@ func (c *BaseConnection) SetStat(virtualPath string, attributes *StatAttributes) if err != nil { return err } - pathForPerms := c.getPathForSetStatPerms(fs, fsPath, virtualPath) + pathForPerms := path.Dir(virtualPath) if attributes.Flags&StatAttrTimes != 0 { if err = c.handleChtimes(fs, fsPath, pathForPerms, attributes); err != nil {