Skip to content

Commit 288c657

Browse files
committed
Correct bad non-hash range param for BL 7.x
This branch correction is not necessary in BL 8, not sure why
1 parent 35646d7 commit 288c657

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

app/presenters/blacklight_range_limit/filter_field.rb

+7-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,13 @@ def remove(item)
5050
def values(except: [])
5151
params = search_state.params
5252
param_key = filters_key
53-
range = if params.dig(param_key, config.key).is_a? Range
53+
range = if !params.try(:dig, param_key).respond_to?(:dig)
54+
# bad data, not a hash at all, correct it. Yes, it's bad form to mutate
55+
# params here, but we found no better solution -- this only necessary in BL
56+
# prior to 8.x, not sure why, but this branch can be omitted in BL 8.
57+
params.delete(param_key)
58+
nil
59+
elsif params.dig(param_key, config.key).is_a? Range
5460
params.dig(param_key, config.key)
5561
elsif params.dig(param_key, config.key).is_a? Hash
5662
b_bound = params.dig(param_key, config.key, :begin).presence

0 commit comments

Comments
 (0)