mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-05 22:17:20 +02:00
WebClient: return proper status code for http.MaxBytesError
Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
@@ -122,7 +122,11 @@ func getMappedStatusCode(err error) int {
|
||||
case errors.Is(err, common.ErrOpUnsupported):
|
||||
statusCode = http.StatusBadRequest
|
||||
default:
|
||||
statusCode = http.StatusInternalServerError
|
||||
if _, ok := err.(*http.MaxBytesError); ok {
|
||||
statusCode = http.StatusRequestEntityTooLarge
|
||||
} else {
|
||||
statusCode = http.StatusInternalServerError
|
||||
}
|
||||
}
|
||||
return statusCode
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user