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

Content negotiation with crossref media type returns empty document instead of error 406 #109

Open
uschindler opened this issue Jun 28, 2022 · 0 comments

Comments

@uschindler
Copy link

When doing content negotiation with the Crossref UNIXREF content type (application/vnd.crossref.unixref+xml) as first Accept header, the datacite service returns an empty string.

It should respond with error code 406 ("not acceptable") and not return empty metadata if it can't support the metadata.

This breaks content negotitaion on DOIs when you request both types (crossref and datacite), e.g.:

  • Accept: application/vnd.crossref.unixref+xml => returns empty string, should fail with error 406
  • Accept: application/vnd.crossref.unixref+xml, application/vnd.datacite.datacite+xml => returns empty string, but to behave correctly it should return datacite metadata
  • Accept: application/vnd.datacite.datacite+xml, application/vnd.crossref.unixref+xml => returns datacite metadata

The workaround is to use the last variant for your Accept header, because then datacite metadata has slightly higher precedence. Zotero is doing this (see https://github.com/zotero/translators/blob/151e9fb702dd9e6908329fbab212bb9b6ca61f55/DOI%20Content%20Negotiation.js#L123), but the order should really not matter at all!

The reason for this behaviour seems to be some commented out code (it looks like DataCite wanted to support UNIXREF at some point) which then returns nothing. Actually the ":crossref" type in the code should be completely removed from the request controller.

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

1 participant