jpie 3.10.1.pre.202609020314 → 3.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -1
- data/lib/json_api/controllers/concerns/controller_helpers/parsing.rb +10 -4
- data/lib/json_api/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: aee1da20dd3c81baafa8bcb78801d128f2b59f76be85b12216f96bf35b822344
|
|
4
|
+
data.tar.gz: 7de107c0fd9ea459ad0f7015d7b0a6877e88462f81b9900cdf022d14788a8118
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6639e6a66ac7c37cbf50372b433f9b1be772d6e1bda28cd76edbfb4a15612c6307bb9412894e0c6eede135aa6e0de321c2726cf3eda493381f746153ff6dd4fc
|
|
7
|
+
data.tar.gz: 1998a903147f3737344b172459656dbb2638525d0371aac16c6951a8c519334ee4ddae641a7a260d200cd41d1c4ea480202bfd476bb930a1f55a8165d1ce4a07
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,17 @@ at release time.
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [3.10.1]
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- Resolve the relationships controller under any module scope. A
|
|
15
|
+
`"controller#action"` string took the surrounding module scope, so every
|
|
16
|
+
relationship route inside a `namespace` or a `scope module:` raised
|
|
17
|
+
`MissingController`.
|
|
18
|
+
- Reject a `page[number]` or `page[size]` above 2147483647. A wider value
|
|
19
|
+
overflowed a 64-bit `OFFSET` and answered 500; it now answers 400.
|
|
20
|
+
|
|
10
21
|
### Added
|
|
11
22
|
|
|
12
23
|
- Open-source documents: `LICENSE`, `NOTICE`, `CONTRIBUTING.md`,
|
|
@@ -28,5 +39,6 @@ at release time.
|
|
|
28
39
|
Releases before 3.10.0 predate this file. Read their history in the git tags
|
|
29
40
|
and in the [GitHub releases](https://github.com/klaayinc/json_api/releases).
|
|
30
41
|
|
|
31
|
-
[Unreleased]: https://github.com/klaayinc/json_api/compare/v3.10.
|
|
42
|
+
[Unreleased]: https://github.com/klaayinc/json_api/compare/v3.10.1...HEAD
|
|
43
|
+
[3.10.1]: https://github.com/klaayinc/json_api/compare/v3.10.0...v3.10.1
|
|
32
44
|
[3.10.0]: https://github.com/klaayinc/json_api/compare/v3.9.0...v3.10.0
|
|
@@ -5,6 +5,10 @@ module JSONAPI
|
|
|
5
5
|
module Parsing
|
|
6
6
|
extend ActiveSupport::Concern
|
|
7
7
|
|
|
8
|
+
# The widest page[number] or page[size] a client may send. A signed 32-bit maximum keeps
|
|
9
|
+
# page[number] * max_page_size inside a 64-bit OFFSET for any page size a server sets.
|
|
10
|
+
PAGE_VALUE_MAX = (2**31) - 1
|
|
11
|
+
|
|
8
12
|
included do
|
|
9
13
|
before_action :parse_jsonapi_body, if: -> { modifying_request? }
|
|
10
14
|
end
|
|
@@ -116,12 +120,14 @@ module JSONAPI
|
|
|
116
120
|
|
|
117
121
|
# page[number]/page[size] are coerced with to_i and used as a divisor and as
|
|
118
122
|
# LIMIT/OFFSET. A non-positive or non-numeric value (0, -5, "abc") produces a
|
|
119
|
-
# divide-by-zero (FloatDomainError) or a negative LIMIT/OFFSET
|
|
120
|
-
#
|
|
123
|
+
# divide-by-zero (FloatDomainError) or a negative LIMIT/OFFSET, and a value above
|
|
124
|
+
# PAGE_VALUE_MAX overflows a 64-bit OFFSET once page[number] is multiplied by the page
|
|
125
|
+
# size. Reject all of them as a bad request instead of letting the raise escape as a 500.
|
|
121
126
|
def require_positive_integer(value, name)
|
|
122
|
-
return if value.to_s.match?(/\A\d+\z/) && value.to_i.
|
|
127
|
+
return if value.to_s.match?(/\A\d+\z/) && value.to_i.between?(1, PAGE_VALUE_MAX)
|
|
123
128
|
|
|
124
|
-
raise JSONAPI::Errors::ParameterNotAllowed,
|
|
129
|
+
raise JSONAPI::Errors::ParameterNotAllowed,
|
|
130
|
+
["#{name} must be a positive integer no greater than #{PAGE_VALUE_MAX}"]
|
|
125
131
|
end
|
|
126
132
|
|
|
127
133
|
def render_sort_errors(invalid)
|
data/lib/json_api/version.rb
CHANGED