Skip to content
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

[production] NoMethodError: undefined method '-' for an instance of ActiveSupport::HashWithIndifferentAccess #4698

Open
regineheberlein opened this issue Jan 13, 2025 · 2 comments
Assignees
Labels

Comments

@regineheberlein
Copy link
Contributor

regineheberlein commented Jan 13, 2025

Expected behavior

A link to a hyphenated author search coming in from facebook succeeds.

Actual behavior

An error is raised having to do with the unescaped hyphen in al-Dīn

Steps to replicate

The link from honeybadger (see below) throws an error, but when I go to the catalog and do the author search, it succeeds. So this may be something specific to how the link was copy/pasted into facebook, rather than something on our end.

Impact of this bug

Users clicking on the link in facebook get an error.

Honeybadger link and code snippet, if applicable

https://app.honeybadger.io/projects/54399/faults/116259519/01JKTYJ7DVRQPGFKAFYEZ25464

NoMethodError: undefined method '-' for an instance of ActiveSupport::HashWithIndifferentAccess params[param][url_key] = collection - Array(value) ^
        collection = params[param][url_key]

        params[param][url_key] = collection - Array(value)
        params[param].delete(url_key) if params[param][url_key].empty?
        params.delete(param) if params[param].empty?

Implementation notes, if any

This seems very similar to #4564

@regineheberlein regineheberlein changed the title [orangelight/production] NoMethodError: undefined method '-' for an instance of ActiveSupport::HashWithIndifferentAccess [production] NoMethodError: undefined method '-' for an instance of ActiveSupport::HashWithIndifferentAccess Jan 14, 2025
@sandbergja sandbergja self-assigned this Feb 10, 2025
@sandbergja
Copy link
Member

After spending some time in the debugger:

  • I believe this happens only in cases where there is a pivot facet configured. Certainly, commenting out our pivot facet allows this query to work
  • I believe there is a bug in Blacklight::SearchState::FilterField#permitted_params. When this is called for a pivot field as part of Blacklight::Parameters#permit_search_params, all the other facet fields suddenly disappear from from the permitted_params

@sandbergja
Copy link
Member

Opened upstream issue projectblacklight/blacklight#3512

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants