Sha256: c99eaf0d3f2d68c8902e4fe4bf0adf514db8c90ace47511c3c4ec99170037890

Contents?: true

Size: 525 Bytes

Versions: 8

Compression:

Stored size: 525 Bytes

Contents

Dor::Identifiable.on_upgrade '3.14.8', 'Fix up invalid URIs in content-augmented datastreams' do |obj|
  bad_content_location_uri = begin
    URI.parse(obj.send("content-augmented").dsLocation)
    false
  rescue URI::InvalidURIError
    true
  rescue
    false
  end

  next unless bad_content_location_uri

  parts = obj.send("content-augmented").dsLocation.split('/')
  parts[parts.length - 1] = URI.escape(parts.last)
  obj.send("content-augmented").dsLocation = parts.join('/')

  obj.send("content-augmented").save
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
dor-services-4.25.1 lib/dor/migrations/identifiable/uriify_augmented_contentlocation_refs.rb
dor-services-4.25.0 lib/dor/migrations/identifiable/uriify_augmented_contentlocation_refs.rb
dor-services-4.24.0 lib/dor/migrations/identifiable/uriify_augmented_contentlocation_refs.rb
dor-services-4.23.0 lib/dor/migrations/identifiable/uriify_augmented_contentlocation_refs.rb
dor-services-4.22.6 lib/dor/migrations/identifiable/uriify_augmented_contentlocation_refs.rb
dor-services-4.22.5 lib/dor/migrations/identifiable/uriify_augmented_contentlocation_refs.rb
dor-services-4.22.4 lib/dor/migrations/identifiable/uriify_augmented_contentlocation_refs.rb
dor-services-5.2.0 lib/dor/migrations/identifiable/uriify_augmented_contentlocation_refs.rb