mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-08 07:10:56 +03:00
don't expose underlying errors to clients
log them and return a generic failure Fixes #896 Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
@@ -1345,9 +1345,11 @@ func (c *BaseConnection) GetGenericError(err error) error {
|
||||
}
|
||||
if err != nil {
|
||||
if e, ok := err.(*os.PathError); ok {
|
||||
c.Log(logger.LevelError, "generic path error: %+v", e)
|
||||
return fmt.Errorf("%w: %v %v", sftp.ErrSSHFxFailure, e.Op, e.Err.Error())
|
||||
}
|
||||
return fmt.Errorf("%w: %v", sftp.ErrSSHFxFailure, err.Error())
|
||||
c.Log(logger.LevelError, "generic error: %+v", err)
|
||||
return fmt.Errorf("%w: %v", sftp.ErrSSHFxFailure, ErrGenericFailure.Error())
|
||||
}
|
||||
return sftp.ErrSSHFxFailure
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user