umlaut 3.0.2 → 3.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -51,7 +51,9 @@ class Referent < ActiveRecord::Base
51
51
  # Apply referent filters
52
52
  rfr_id = ""
53
53
  rfr_id = co.referrer.identifier if (co.referrer && ! co.referrer.identifier.blank?)
54
- UmlautController.umlaut_config.lookup!("referent_filters", []).each do |regexp, filter|
54
+ UmlautController.umlaut_config.lookup!("referent_filters", []).each do |filter_config|
55
+ regexp = filter_config[:match]
56
+ filter = filter_config[:filter]
55
57
  if (regexp =~ rfr_id)
56
58
  filter.filter(rft) if filter.respond_to?(:filter)
57
59
  end
@@ -93,7 +93,7 @@ class Blacklight < Service
93
93
  #keyword search.
94
94
  if (@keyword_search &&
95
95
  url = blacklight_keyword_search_url(request))
96
-
96
+
97
97
  doc = Nokogiri::XML( http_fetch(url).body )
98
98
  # filter out matches whose titles don't really match at all, or
99
99
  # which have already been seen in identifier search.
@@ -323,8 +323,11 @@ class Sfx < Service
323
323
  # Sfx metadata we want
324
324
  response_data[:sfx_base_url] = @base_url
325
325
  response_data[:sfx_obj_index] = sfx_obj_index + 1 # sfx is 1 indexed
326
- response_data[:sfx_target_index] = target_index + 1
327
- response_data[:sfx_request_id] = (perl_data/"//hash/item[@key='sfx.request_id']").first.inner_text
326
+ response_data[:sfx_target_index] = target_index + 1
327
+ # sometimes the sfx.request_id is missing, go figure.
328
+ if request_id = (perl_data/"//hash/item[@key='sfx.request_id']").first
329
+ response_data[:sfx_request_id] = request_id.inner_text
330
+ end
328
331
  response_data[:sfx_target_service_id] = target_service_id
329
332
  response_data[:sfx_target_name] = sfx_target_name
330
333
  # At url-generation time, the request isn't available to us anymore,
@@ -453,6 +456,12 @@ class Sfx < Service
453
456
  key = item['key'].to_s
454
457
 
455
458
  value = item.inner_text
459
+
460
+ # SFX sometimes returns invalid UTF8 (is it really ISO 8859? Is it
461
+ # predictable? Who knows. If it's not valid, it'll cause all
462
+ # sorts of problems later. So if it's not valid, we're just
463
+ # going to ignore it, sorry.
464
+ next unless value.valid_encoding?
456
465
 
457
466
  # Some normalization. SFX uses rft.year, which is not actually
458
467
  # legal. Stick it in rft.date instead.
@@ -482,7 +491,7 @@ class Sfx < Service
482
491
  # But this still has HTML entities in it sometimes. Now we've
483
492
  # got to decode THAT.
484
493
  # TODO: Are we sure we need to do this? We need an example
485
- # from SFX result to test, it's potentially expensive.
494
+ # from SFX result to test, it's potentially expensive.
486
495
  value = html_ent_coder.decode(value)
487
496
 
488
497
  # object_type? Fix that to be the right way.
@@ -1,3 +1,3 @@
1
1
  module Umlaut
2
- VERSION = "3.0.2"
2
+ VERSION = "3.0.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: umlaut
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.2
4
+ version: 3.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-12 00:00:00.000000000 Z
12
+ date: 2012-08-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -575,7 +575,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
575
575
  version: '0'
576
576
  segments:
577
577
  - 0
578
- hash: 3369968520259252587
578
+ hash: -1929703717396747492
579
579
  required_rubygems_version: !ruby/object:Gem::Requirement
580
580
  none: false
581
581
  requirements:
@@ -584,7 +584,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
584
584
  version: '0'
585
585
  segments:
586
586
  - 0
587
- hash: 3369968520259252587
587
+ hash: -1929703717396747492
588
588
  requirements: []
589
589
  rubyforge_project:
590
590
  rubygems_version: 1.8.24