Skip to content

Commit

Permalink
Merge pull request #6108 from avalonmediasystem/subject_link
Browse files Browse the repository at this point in the history
Don't escape values let Blacklight handle that
  • Loading branch information
cjcolvar authored Nov 11, 2024
2 parents bf27f8c + 9bad0e2 commit 178633c
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/iiif_manifest_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def series_url(series)

def display_search_linked(solr_field, values)
Array(values).collect do |value|
url = Rails.application.routes.url_helpers.blacklight_url({ "f[#{solr_field}][]" => RSolr.solr_escape(value) })
url = Rails.application.routes.url_helpers.blacklight_url({ "f[#{solr_field}][]" => value })
"<a href='#{url}'>#{value}</a>"
end
end
Expand Down
30 changes: 30 additions & 0 deletions spec/requests/search_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Copyright 2011-2024, The Trustees of Indiana University and Northwestern
# University. Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
#
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed
# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
# CONDITIONS OF ANY KIND, either express or implied. See the License for the
# specific language governing permissions and limitations under the License.
# --- END LICENSE_HEADER BLOCK ---

require 'rails_helper'

describe 'search', type: :request do
describe 'subject links' do
let!(:media_object) { FactoryBot.create(:fully_searchable_media_object, subject: ['both/and']) }

it 'searches and finds the item' do
get "/media_objects/#{media_object.id}/manifest.json"
manifest_json = JSON.parse(response.body)
subject_links = manifest_json["metadata"].find {|hash| hash["label"]["none"] == ["Subject"] }["value"]["none"]
link = subject_links.first.match(/href="(.*)"/)[1]
get link
expect(response.body).to include(media_object.id)
end
end
end

0 comments on commit 178633c

Please sign in to comment.