From 9dd36054e9f1f2338e5f5079161754cbc0f26b00 Mon Sep 17 00:00:00 2001 From: Christian Richter Date: Tue, 24 May 2022 12:01:13 +0200 Subject: [PATCH 1/3] fix missing status code for insufficient disk space Signed-off-by: Christian Richter --- pkg/errtypes/errtypes.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pkg/errtypes/errtypes.go b/pkg/errtypes/errtypes.go index 14d18f744c..142bba1add 100644 --- a/pkg/errtypes/errtypes.go +++ b/pkg/errtypes/errtypes.go @@ -145,6 +145,16 @@ func (e InsufficientStorage) Error() string { return "error: insufficient storag // IsInsufficientStorage implements the IsInsufficientStorage interface. func (e InsufficientStorage) IsInsufficientStorage() {} +// StatusCode returns StatusInssufficientStorage, this implementation is neede to allow TUS to cast the correct http errors. +func (e InsufficientStorage) StatusCode() int { + return StatusInssufficientStorage +} + +// Body returns the error body. 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 From a7b7bfe2f294d4073675a4d885a83335693faeca Mon Sep 17 00:00:00 2001 From: Christian Richter Date: Tue, 24 May 2022 12:12:19 +0200 Subject: [PATCH 2/3] add changelog Signed-off-by: Christian Richter --- changelog/unreleased/fix-missing-statuscode.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 changelog/unreleased/fix-missing-statuscode.md diff --git a/changelog/unreleased/fix-missing-statuscode.md b/changelog/unreleased/fix-missing-statuscode.md new file mode 100644 index 0000000000..01212f22a5 --- /dev/null +++ b/changelog/unreleased/fix-missing-statuscode.md @@ -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 From 8fc606e65bff5cbbe24b9b6b53a781fdad4152bd Mon Sep 17 00:00:00 2001 From: Christian Richter Date: Tue, 24 May 2022 12:15:20 +0200 Subject: [PATCH 3/3] incorporate requested changes Signed-off-by: Christian Richter --- pkg/errtypes/errtypes.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/errtypes/errtypes.go b/pkg/errtypes/errtypes.go index 142bba1add..95cf3a5f5e 100644 --- a/pkg/errtypes/errtypes.go +++ b/pkg/errtypes/errtypes.go @@ -145,19 +145,19 @@ func (e InsufficientStorage) Error() string { return "error: insufficient storag // IsInsufficientStorage implements the IsInsufficientStorage interface. func (e InsufficientStorage) IsInsufficientStorage() {} -// StatusCode returns StatusInssufficientStorage, this implementation is neede to allow TUS to cast the correct http errors. +// StatusCode returns StatusInsufficientStorage, this implementation is needed to allow TUS to cast the correct http errors. func (e InsufficientStorage) StatusCode() int { - return StatusInssufficientStorage + return StatusInsufficientStorage } -// Body returns the error body. This implementation is neede to allow TUS to cast the correct http errors +// 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()) } -// StatusInssufficientStorage 507 is an official http status code to indicate that there is insufficient storage +// 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.