move stat to base connection and differentiate between Stat and Lstat

we will use Lstat once it will be exposed in pkg/sftp
This commit is contained in:
Nicola Murino
2020-08-25 18:23:00 +02:00
parent 701a6115f8
commit 2746c0b0f1
9 changed files with 66 additions and 14 deletions

View File

@@ -440,6 +440,14 @@ func (c *BaseConnection) getPathForSetStatPerms(fsPath, virtualPath string) stri
return pathForPerms
}
// DoStat execute a Stat if mode = 0, Lstat if mode = 1
func (c *BaseConnection) DoStat(fsPath string, mode int) (os.FileInfo, error) {
if mode == 1 {
return c.Fs.Lstat(c.getRealFsPath(fsPath))
}
return c.Fs.Stat(c.getRealFsPath(fsPath))
}
// SetStat set StatAttributes for the specified fsPath
func (c *BaseConnection) SetStat(fsPath, virtualPath string, attributes *StatAttributes) error {
if Config.SetstatMode == 1 {