Skip to content

Conversation

@codycooperross
Copy link
Contributor

@codycooperross codycooperross commented Nov 4, 2025

We don't actively support content negotiation requests for Crossref XML, i.e. application/vnd.crossref.unixref+xml, but previously returned a blank response when using this header. This blank response was rendered by bolognese: https://github.com/datacite/bolognese/blob/64b18d1439801216c7ce59e5a76a7c383d171161/lib/bolognese/writers/crossref_writer.rb#L3-L11 This change removes internal support for application/vnd.crossref.unixref+xml and instead treats it as an unsupported content type.

closes: datacite/datacite#2448

@codycooperross codycooperross changed the title Crossref bug Return 303 status code for unsupported application/vnd.crossref.unixref+xml content type Nov 4, 2025
it "header" do
get "/#{doi}", nil, { "HTTP_ACCEPT" => "application/vnd.crossref.unixref+xml" }

expect(last_response.status).to eq(303)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why would it return 303? Shouldn't it return 406 (looking at code)

Copy link
Contributor Author

@codycooperross codycooperross Nov 4, 2025

Choose a reason for hiding this comment

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

I was basing this on the other tests here:

context "unknown accept header" do
it "header" do
get "/#{doi}", nil, { "HTTP_ACCEPT" => "application/xml" }
expect(last_response.status).to eq(303)
expect(last_response.headers["Location"]).to eq("https://blog.datacite.org/announcing-schema-4-2/")
end
it "link" do
get "/application/xml/#{doi}"
expect(last_response.status).to eq(404)
expect(last_response.body).to eq("The resource you are looking for doesn't exist.")
end
end

But good point. I can take a look.

Copy link
Contributor

Choose a reason for hiding this comment

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

It's entirely possible that it does return a 303, I don't see where, but I'm not overly familiar with this codebase. I wouldn't worry too much as long as it's logically consistent.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Currently, we return 303s when a content type is not recognized. Try this:

curl --location 'https://doi.org/10.48322/553p-pm90' \
--header 'Accept: application/not-real-content-type'

That aligns with my understanding of how content negotiation is intended to work. If the content type is supported, then the formatted content is returned; if the content type is not supported, then the landing page is returned.

Copy link
Contributor

Choose a reason for hiding this comment

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

I guess the 303 is because it throws it off to the end DOI url to be processed. Alright fair enough

@codycooperross codycooperross merged commit 2609ec9 into master Nov 4, 2025
1 check passed
@codycooperross codycooperross deleted the crossref-bug branch November 4, 2025 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants