Skip to content

Commit

Permalink
Merge pull request #5441 from avalonmediasystem/playlist_deleted_source
Browse files Browse the repository at this point in the history
Fix manifest generation for playlist item with deleted source
  • Loading branch information
masaball authored Oct 31, 2023
2 parents b3bf541 + 3c3f512 commit de05671
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ GIT

GIT
remote: https://github.com/samvera-labs/iiif_manifest.git
revision: c8ca0c6e54517446419c20221260eaf3dcf46d4e
revision: c7467b4ae32934f161bd2cabdd741ec9293cefe6
branch: main
specs:
iiif_manifest (1.3.1)
Expand Down
2 changes: 2 additions & 0 deletions app/models/iiif_playlist_canvas_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,15 @@ def master_file
end

def part_of
return if master_file.nil?
[{
"@id" => Rails.application.routes.url_helpers.manifest_media_object_url(master_file.media_object_id).to_s,
"type" => "manifest"
}]
end

def item_metadata
return if master_file.nil?
[
metadata_field('Title', master_file.media_object.title),
metadata_field('Date', master_file.media_object.date_issued),
Expand Down
12 changes: 12 additions & 0 deletions spec/controllers/playlists_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -618,5 +618,17 @@
expect(parsed_response['items'][1]['items'][0].keys).to_not include 'items'
end
end

context "playlist item with deleted source" do
before do
master_file.delete
end

it "returns a blank canvas" do
get :manifest, format: 'json', params: { id: playlist.id }, session: valid_session
parsed_response = JSON.parse(response.body)
expect(parsed_response['items'][0]['items'][0].keys).to_not include 'items'
end
end
end
end

0 comments on commit de05671

Please sign in to comment.