Skip to content

Commit

Permalink
DC format OpenURL does not raise
Browse files Browse the repository at this point in the history
  • Loading branch information
jrochkind committed Apr 2, 2015
1 parent 0062156 commit dc377f6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
3 changes: 3 additions & 0 deletions RELEASE_NOTES.md
Expand Up @@ -42,9 +42,12 @@ BUG FIXES
properly assigned service wave, and/or executed more than once. This has been fixed.
* MetadataHelper#normalize_title work properly for non-ascii unicode.
* MetadataHelper#title_is_serial? more complex logic.
* Dublin Core format OpenURL doesn't cause an exception anymore (but don't count
on Umlaut doing anything very useful with it)
* Assorted other minor bug fixes.



SERVICE-SPECIFIC

* InternetArchive: Require closer title match to count as a hit.
Expand Down
6 changes: 5 additions & 1 deletion app/models/referent.rb
Expand Up @@ -151,7 +151,11 @@ def set_values_from_context_object(co)

rft.metadata.each { | key, value |
next unless value.present?
build_referent_value( key, value)
# Sometimes value is an array, for DC for instance. Do the best we
# can.
Array(value).each do |v|
build_referent_value( key, v)
end
}
end

Expand Down
8 changes: 8 additions & 0 deletions test/unit/request_test.rb
Expand Up @@ -42,7 +42,15 @@ class RequestTest < ActiveSupport::TestCase
)

assert_length 1, request.get_service_type(:highlighted_link)
end

test "DC format metadata does not raise" do
# Can't promise we can do much useful with it, but it shouldn't raise
params = Rack::Utils.parse_nested_query 'rfr_id=info%3Asid%2Fzotero.org%3A2&rft.source=The+New+Yorker&rft.type=webpage&rft.description=How+Xi+Jinping+took+control+of+China.&rft.identifier=http%3A%2F%2Fwww.newyorker.com%2Fmagazine%2F2015%2F04%2F06%2Fborn-red&ctx_ver=Z39.88-2004&url_ver=Z39.88-2004&rft.title=Rise+of+the+Red+Prince&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Adc&umlaut.force_new_request=true'
co = OpenURL::ContextObject.new_from_form_vars( params )
rft = Referent.create_by_context_object(co)
end



end

0 comments on commit dc377f6

Please sign in to comment.