crosscite / content-negotiation

DOI content negotiation
https://data.crosscite.org
MIT License
3 stars 4 forks source link

Incomplete Metadata retrieval when asking for application/vnd.datacite.datacite+xml/ #2

Closed kjgarza closed 7 years ago

kjgarza commented 7 years ago

Caching in different content format is breaking CN XML request

To add logic to bypass caching on application/vnd.datacite.datacite+xml content

mfenner commented 7 years ago

The index_controller should have this line to initialize model:

@metadata = Metadata.new(input: @id, from: from, format: format)

And both from and format defined in the controller before the call:

format = Mime::Type.lookup(@content_type).to_sym
from = Bolognese.find_from_format(id: @id)
mfenner commented 7 years ago

In metadata model change line to

def initialize(input: nil, from: nil, format: nil)
  # don't cache if passing thru metadata or when in Test mode
  return super(input: input, from: from) if from == format.to_s || %w(test).include?(Rails.env)
kjgarza commented 7 years ago

Fixed with commit c0220b4425275e3457158d8926c721ac095f26a1