ubiquitypress / hyku_addons

Ubiquity Press addons to hyku
Apache License 2.0
3 stars 0 forks source link

ActionController::UnknownFormat error when accessing private non-html/json response #33

Open prdanelli opened 3 years ago

prdanelli commented 3 years ago

When accessing a default Rails response type (JSON/HTML) for a non-visible work, the following error is received:

{"code":401,"message":"Authentication Required","description":"You must be logged in to do that!"}

And the default HTML response is to redirect the user to the login screen and return a CanCan error.

However, with non-default formats, like RIS (in the PR) or JSONLD, an ActionController::UnknownFormat error is returned.

I would have assumed that this is not the case because the format is registered outside of the request.

Screenshot from 2020-12-30 10-25-30 Screenshot from 2020-12-30 10-26-05

cjcolvar commented 3 years ago

I saw this in your tests as well and found it odd. This seems like a place where we could contribute a better response upstream to hyrax since it looks like it is happening in Hyrax::Controller#deny_access_for_anonymous_user.