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

Fix shared search URLs #1844

Merged
merged 6 commits into from
Sep 27, 2022
Merged

Fix shared search URLs #1844

merged 6 commits into from
Sep 27, 2022

Conversation

laritakr
Copy link
Collaborator

@laritakr laritakr commented Sep 23, 2022

Fixes remaining problems with UTK issue 80

Blacklight's search_context.js introduces click-jacking behavior for A-tags that conflict with shared search tenant behavior. This click-jacking behavior uses a relative path in its form submission.

The manifestation of this problem is when you click on an item in the shared search tenant catalog index and get a Faraday error that has the port 99999. That 99999 means that there’s no loaded tenant the various endpoints (see AccountEndpoints module) for Solr and Fedora use the nil handler and our nil endpoint handler is loaded. See the NilSolrEndpoint. This is evident in the work of UTK issue 80, where we coerced an ID (which normally renders as a path) to a URL to the host tenant.

To remedy the link jacking, we have two options:

  1. Amend Blacklight::UrlHelperBehavior#document_link_params to ignore the the session_tracking_params method call when dealing with a full URL.
  2. Amend Blacklight::UrlHelperBehavior#session_tracking_path to return a URL instead of a relative path.

Changes proposed in this pull request:

  • Use the first of the two options listed above to allow full links to resolve
  • Remove CatalogHelperBehavior overrides which are now obsolete
  • Remove partials previously overridden from Hyrax which are no longer needed due to this change

@samvera/hyku-code-reviewers

Copy link
Collaborator

@ShanaLMoore ShanaLMoore left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know you are leaving for the day so I plan to correct this @laritakr

@ShanaLMoore ShanaLMoore self-requested a review September 23, 2022 21:42
Copy link
Collaborator

@ShanaLMoore ShanaLMoore left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Taking this for a spin, after I created a work w a fileset for each tenant. I then made a collection. I was going back to the work's show page to add the work to the collection but ran into this error:

Screen Shot 2022-09-23 at 3 02 54 PM

Not sure if it's related to the changes in this PR but I'd like to take some time to look into it and maybe correct it here if so.

@ShanaLMoore
Copy link
Collaborator

Taking this for a spin, after I created a work w a fileset for each tenant. I then made a collection. I was going back to the work's show page to add the work to the collection but ran into this error:

Screen Shot 2022-09-23 at 3 02 54 PM

Not sure if it's related to the changes in this PR but I'd like to take some time to look into it and maybe correct it here if so.

The issue is that from the catalog controller, doc is a solr document. but from the work show page it's a fileset presenter and calling to_h doesn't work in that context.

@ShanaLMoore
Copy link
Collaborator

ShanaLMoore commented Sep 23, 2022

@laritakr I pushed up what I think may be the fix to the issue described above. Please review at your convenience.

  • I tested that the shared search links and links via thumbnails are all going to the correct place.
  • I also tested that the thumbnails on the work's show page still work

I approve this PR if you agree with my changes. Otherwise ping me again when this is ready, if you decide to do something different to resolve it.

Demo: https://share.getcloudapp.com/X6uQAJBN
Screenshots:

Screen Shot 2022-09-23 at 4 03 59 PM
Screen Shot 2022-09-23 at 4 03 47 PM

@ShanaLMoore
Copy link
Collaborator

ShanaLMoore commented Sep 23, 2022

As an update, I pulled over the fix from UTK. I retested it and it's all still working.

@laritakr
Copy link
Collaborator Author

Thanks for following up, @ShanaLMoore The changes you made are what I had in mind.

@ShanaLMoore ShanaLMoore self-requested a review September 27, 2022 16:23
@laritakr laritakr merged commit 8839d1e into main Sep 27, 2022
@laritakr laritakr deleted the rework-utk-80 branch September 27, 2022 16:30
@bkiahstroud bkiahstroud added the patch-ver for release notes label Feb 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
patch-ver for release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants