mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-07 06:40:54 +03:00
add a nil check for attributes
just defensive code Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
@@ -353,6 +353,7 @@ func (c *Connection) handleSFTPSetstat(request *sftp.Request) error {
|
||||
attrs := common.StatAttributes{
|
||||
Flags: 0,
|
||||
}
|
||||
if request.Attributes() != nil {
|
||||
if request.AttrFlags().Permissions {
|
||||
attrs.Flags |= common.StatAttrPerms
|
||||
attrs.Mode = request.Attributes().FileMode()
|
||||
@@ -371,6 +372,7 @@ func (c *Connection) handleSFTPSetstat(request *sftp.Request) error {
|
||||
attrs.Flags |= common.StatAttrSize
|
||||
attrs.Size = int64(request.Attributes().Size)
|
||||
}
|
||||
}
|
||||
|
||||
return c.SetStat(request.Filepath, &attrs)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user