From d3db80dc3260648ea4846092bdb2f5669e4018c7 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 95ba1dd5..da453e1e 100644 --- a/internal/common/connection.go +++ b/internal/common/connection.go @@ -925,16 +925,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) { @@ -1071,7 +1061,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 {