-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Handle Rack errors when too many files are uploaded #2256
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this does change API behavior, increment the version to 1.7.0 as part of this PR?
Also do check those edge errors please. We can ignore them, but I want to make sure it's not related to this change.
Thanks!
CHANGELOG.md
Outdated
@@ -18,6 +18,7 @@ | |||
* [#2227](https://github.com/ruby-grape/grape/pull/2222): Rename `MissingGroupType` and `UnsupportedGroupType` exceptions - [@ericproulx](https://github.com/ericproulx). | |||
* [#2244](https://github.com/ruby-grape/grape/pull/2244): Fix a breaking change in `Grape::Validations` provided in 1.6.1 - [@dm1try](https://github.com/dm1try). | |||
* [#2250](https://github.com/ruby-grape/grape/pull/2250): Add deprecation warning for `UnsupportedGroupTypeError` and `MissingGroupTypeError` - [@ericproulx](https://github.com/ericproulx). | |||
* [#2256](https://github.com/ruby-grape/grape/pull/2256): Handle MultipartPartLimitError from Rack when too many files are uploaded - [@bschmeck](https://github.com/bschmeck). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's say "Raise Grape::Exceptions::TooManyMultipartFiles
on MultipartPartLimitError
, when too many files are uploaded"?
Thanks. I've updated the wording in the changelog. Please let me know if I need to move anything around as a result of the minor version bump. I see the same failures against |
@bschmeck Yes, please increment the version in version.rb and anywhere else we say "1.6.3", including CHANGELOG |
CHANGELOG.md
Outdated
@@ -18,6 +18,7 @@ | |||
* [#2227](https://github.com/ruby-grape/grape/pull/2222): Rename `MissingGroupType` and `UnsupportedGroupType` exceptions - [@ericproulx](https://github.com/ericproulx). | |||
* [#2244](https://github.com/ruby-grape/grape/pull/2244): Fix a breaking change in `Grape::Validations` provided in 1.6.1 - [@dm1try](https://github.com/dm1try). | |||
* [#2250](https://github.com/ruby-grape/grape/pull/2250): Add deprecation warning for `UnsupportedGroupTypeError` and `MissingGroupTypeError` - [@ericproulx](https://github.com/ericproulx). | |||
* [#2256](https://github.com/ruby-grape/grape/pull/2256): Raise Grape::Exceptions::MultipartPartLimitError from Rack when too many files are uploaded - [@bschmeck](https://github.com/bschmeck). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Back-tick quote Grape::Exceptions::MultipartPartLimitError
Should/can the message include the system limit number? |
The introduction of the TooManyMultipartFiles changes API behavior, so bump the minor version.
…sage The number of allowed multipart files is a configurable value in Rack, pull that limit and include it in the generated error message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Promise last one: in UPGRADING.md add a paragraph that says something along the lines of
Handling Multipart Limit Errors
... if you were handling Rack::Multipart::MultipartPartLimitError
, Grape will now throw Grape::Exceptions::TooManyMultipartFiles
...
Done. Thanks for your help. Let me know if there's anything else! |
Merged, thanks for hanging in here with me @bschmeck ! |
Rack enforces a limit on the number of files that can be uploaded in a single request. Currently, Grape does not handle the error that Rack raises when such a request is received. This PR catches that error and returns with a
Payload Too Large (413)
status code.