Skip to content

Commit

Permalink
generate iiif manifest URLs from the resource ID, not the image ID
Browse files Browse the repository at this point in the history
The manifest controller expects the URL to include the exhibit ID and resource
ID, but the indexer has been using the ID of the resource's FeaturedImage
instead.  This doesn't always cause issues, because in many situations the ID of
a resource's FeaturedImage and the ID of the resource itself have the same
numerical representation.  But those numbers can fall out of sync, and manifests
will fail to load.
  • Loading branch information
dunn committed Apr 24, 2023
1 parent 9c0ae85 commit 8be39df
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/models/spotlight/resources/upload.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def to_solr
spotlight_full_image_width_ssm: dimensions.width,
spotlight_full_image_height_ssm: dimensions.height,
Spotlight::Engine.config.thumbnail_field => Spotlight::Engine.config.iiif_service.thumbnail_url(upload),
Spotlight::Engine.config.iiif_manifest_field => Spotlight::Engine.config.iiif_service.manifest_url(exhibit, upload)
Spotlight::Engine.config.iiif_manifest_field => Spotlight::Engine.config.iiif_service.manifest_url(exhibit, self)
}
end

Expand Down
6 changes: 3 additions & 3 deletions lib/spotlight/riiif_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ def self.info_url(image, _host = nil)
end

# @param [Spotlight::Exhibit] exhibit
# @param [Spotlight::FeaturedImage] image
# @param [Spotlight::Resource::Upload] resource
# @return [String]
def self.manifest_url(exhibit, image)
Spotlight::Engine.routes.url_helpers.manifest_exhibit_solr_document_path(exhibit, "#{exhibit.id}-#{image.id}")
def self.manifest_url(exhibit, resource)
Spotlight::Engine.routes.url_helpers.manifest_exhibit_solr_document_path(exhibit, "#{exhibit.id}-#{resource.id}")
end

# @param [String] id
Expand Down

0 comments on commit 8be39df

Please sign in to comment.