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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 77c269f352f52e8757d0dcad28af7987bd83e151607b4d2e3a1f4c8091181078
4
- data.tar.gz: aefd634c9df9be3090b5d256946aad77bb5fd5cd7d9a482a5c99c517c1a6a670
3
+ metadata.gz: aee1da20dd3c81baafa8bcb78801d128f2b59f76be85b12216f96bf35b822344
4
+ data.tar.gz: 7de107c0fd9ea459ad0f7015d7b0a6877e88462f81b9900cdf022d14788a8118
5
5
  SHA512:
6
- metadata.gz: c1f18a739c4d517b537eb95ff2b4889cc2ca3879fa2f720719feb0ef25d97850c5c54555465048dd786e2082b0b8cc75de8393d1f0028774f90a8ba83f0bad14
7
- data.tar.gz: 541c1b7783c40d3759dd053c00a31e547ab383a8ba961516880948a57667dd7eafabf54057532e44234c77e4986917c88e68741a65167f6abc9f6361981c95a1
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.0...HEAD
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. Reject it as a
120
- # bad request instead of letting the raise escape as a 500.
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.positive?
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, ["#{name} must be a positive integer"]
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)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module JSONAPI
4
- VERSION = "3.10.1.pre.202609020314"
4
+ VERSION = "3.10.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jpie
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.10.1.pre.202609020314
4
+ version: 3.10.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Emil Kampp