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

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

Open
prdanelli opened this issue Dec 30, 2020 · 1 comment

Comments

@prdanelli
Copy link
Contributor

prdanelli commented Dec 30, 2020

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
Copy link
Contributor

cjcolvar commented Jan 4, 2021

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.

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

No branches or pull requests

2 participants