ransack 6.0.0 → 6.0.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/lib/ransack/helpers/form_helper.rb +16 -6
- data/lib/ransack/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: 9940472d0658f87581dd23a9668c17b557806f72735ed8e66ceef5332c099d8b
|
|
4
|
+
data.tar.gz: 576b1c827db6b63a08d980c91fd063eee4b5bbdb359503a9c4af0bacfc134cfe
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 173aab57088df1db09eff37d4e3098ebbb18042fe387ab151958d7d5a892481bbfffc2cd35b1934f87e015c79bdd60f53d3be6a1828e9d541cda76725947a19e
|
|
7
|
+
data.tar.gz: 759843af14c0312b0167661a6e650bf933da0cb8ee652ad381452b7509f9e348f59c4a45fa274f6f0364bb78e48a142e171788039fd8f9690e50200108f8c1f3
|
|
@@ -162,6 +162,17 @@ module Ransack
|
|
|
162
162
|
end
|
|
163
163
|
|
|
164
164
|
class SortLink
|
|
165
|
+
# Keys url_for reads as instructions for building the link, not as
|
|
166
|
+
# query params. The request's params are carried over into the link,
|
|
167
|
+
# so a crafted query string could otherwise change its scheme, host,
|
|
168
|
+
# port, path prefix or route (GHSA-58rx-96gf-w92x). Userinfo needs
|
|
169
|
+
# :user and :password together, so dropping :password is enough to
|
|
170
|
+
# keep a ?user= filter.
|
|
171
|
+
RESERVED_URL_OPTIONS = (
|
|
172
|
+
ActionDispatch::Routing::RouteSet::RESERVED_OPTIONS +
|
|
173
|
+
%i[password use_route _recall]
|
|
174
|
+
).freeze
|
|
175
|
+
|
|
165
176
|
def initialize(search, attribute, args, params)
|
|
166
177
|
@search = search
|
|
167
178
|
@params = parameters_hash(params)
|
|
@@ -195,7 +206,7 @@ module Ransack
|
|
|
195
206
|
end
|
|
196
207
|
|
|
197
208
|
def url_options
|
|
198
|
-
@params.except(
|
|
209
|
+
@params.except(*RESERVED_URL_OPTIONS).merge(
|
|
199
210
|
@options.except(:class, :data, :host).merge(
|
|
200
211
|
@search.context.search_key => search_and_sort_params))
|
|
201
212
|
end
|
|
@@ -218,12 +229,11 @@ module Ransack
|
|
|
218
229
|
|
|
219
230
|
private
|
|
220
231
|
|
|
232
|
+
# Indifferent access, so RESERVED_URL_OPTIONS also matches the string
|
|
233
|
+
# keys of a plain Hash.
|
|
221
234
|
def parameters_hash(params)
|
|
222
|
-
if params.respond_to?(:to_unsafe_h)
|
|
223
|
-
|
|
224
|
-
else
|
|
225
|
-
params
|
|
226
|
-
end
|
|
235
|
+
params = params.to_unsafe_h if params.respond_to?(:to_unsafe_h)
|
|
236
|
+
params.with_indifferent_access
|
|
227
237
|
end
|
|
228
238
|
|
|
229
239
|
def extract_sort_fields_and_mutate_args!(args)
|
data/lib/ransack/version.rb
CHANGED