mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-07 14:50:55 +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{
|
attrs := common.StatAttributes{
|
||||||
Flags: 0,
|
Flags: 0,
|
||||||
}
|
}
|
||||||
|
if request.Attributes() != nil {
|
||||||
if request.AttrFlags().Permissions {
|
if request.AttrFlags().Permissions {
|
||||||
attrs.Flags |= common.StatAttrPerms
|
attrs.Flags |= common.StatAttrPerms
|
||||||
attrs.Mode = request.Attributes().FileMode()
|
attrs.Mode = request.Attributes().FileMode()
|
||||||
@@ -371,6 +372,7 @@ func (c *Connection) handleSFTPSetstat(request *sftp.Request) error {
|
|||||||
attrs.Flags |= common.StatAttrSize
|
attrs.Flags |= common.StatAttrSize
|
||||||
attrs.Size = int64(request.Attributes().Size)
|
attrs.Size = int64(request.Attributes().Size)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return c.SetStat(request.Filepath, &attrs)
|
return c.SetStat(request.Filepath, &attrs)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user