Skip to content

Commit

Permalink
Merge pull request #919 from sul-dlss/only-cocina
Browse files Browse the repository at this point in the history
Don't try to deserialize XML as JSON
  • Loading branch information
justinlittman authored Aug 23, 2024
2 parents f2b63be + a5e92a7 commit 72bc782
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/models/public_json.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ def data
end

def cocina_hash
return {} unless data_type == 'cocina' # Legacy metadata (xml), doesn't set this

JSON.parse(data)
end
end
2 changes: 2 additions & 0 deletions spec/factories/public_jsons.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
FactoryBot.define do
factory :public_json do
data_type { 'cocina' }

data do
Cocina::RSpec::Factories.build(:dro_with_metadata, id: purl.druid)
.new(access: { view: 'world' },
Expand Down

0 comments on commit 72bc782

Please sign in to comment.