Skip to content

Commit

Permalink
fix missing status code for insufficient disk space
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Richter <crichter@owncloud.com>
  • Loading branch information
dragonchaser committed May 24, 2022
1 parent 51d4c29 commit 698ac9e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pkg/errtypes/errtypes.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,16 @@ func (e InsufficientStorage) Error() string { return "error: insufficient storag
// IsInsufficientStorage implements the IsInsufficientStorage interface.
func (e InsufficientStorage) IsInsufficientStorage() {}

// This implementation is neede to allow TUS to cast the correct http errors
func (e InsufficientStorage) StatusCode() int {
return StatusInssufficientStorage
}

// This implementation is neede to allow TUS to cast the correct http errors
func (e InsufficientStorage) Body() []byte {
return []byte(e.Error())
}

// StatusInssufficientStorage 507 is an official http status code to indicate that there is insufficient storage
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/507
const StatusInssufficientStorage = 507
Expand Down

0 comments on commit 698ac9e

Please sign in to comment.