Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix missing status code for insufficient disk space #2891

Merged
merged 3 commits into from
May 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions changelog/unreleased/fix-missing-statuscode.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Bugfix: Add missing http status code

This Fix adds a missing status code to the InsufficientStorage error in reva, to allow tus to pass it through.

https://github.com/cs3org/reva/pull/2891
14 changes: 12 additions & 2 deletions pkg/errtypes/errtypes.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,19 @@ func (e InsufficientStorage) Error() string { return "error: insufficient storag
// IsInsufficientStorage implements the IsInsufficientStorage interface.
func (e InsufficientStorage) IsInsufficientStorage() {}

// StatusInssufficientStorage 507 is an official http status code to indicate that there is insufficient storage
// StatusCode returns StatusInsufficientStorage, this implementation is needed to allow TUS to cast the correct http errors.
func (e InsufficientStorage) StatusCode() int {
return StatusInsufficientStorage
}

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

// StatusInsufficientStorage 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
const StatusInsufficientStorage = 507

// IsNotFound is the interface to implement
// to specify that an a resource is not found.
Expand Down