diff --git a/app/assets/templates/digital_objects_app/widgets/digital_object_editor/_header.ejs b/app/assets/templates/digital_objects_app/widgets/digital_object_editor/_header.ejs index 09a7b48b6..cd99990e9 100644 --- a/app/assets/templates/digital_objects_app/widgets/digital_object_editor/_header.ejs +++ b/app/assets/templates/digital_objects_app/widgets/digital_object_editor/_header.ejs @@ -198,7 +198,7 @@
<%= digitalObject.getFilesystemLocation() %> diff --git a/app/models/concerns/digital_object/assets/file_import.rb b/app/models/concerns/digital_object/assets/file_import.rb index bede7cc62..b9b0d555c 100644 --- a/app/models/concerns/digital_object/assets/file_import.rb +++ b/app/models/concerns/digital_object/assets/file_import.rb @@ -41,7 +41,7 @@ def do_file_import puts "final_save_location_uri is: #{final_save_location_uri}" content_ds = @fedora_object.create_datastream(ActiveFedora::Datastream, 'content', controlGroup: 'E', mimeType: BestType.mime_type.for_file_name(original_filename), dsLabel: original_filename, versionable: true) content_ds.dsLocation = Hyacinth::Utils::PathUtils.location_uri_to_encoded_ds_location(final_save_location_uri) - @fedora_object.datastreams["DC"].dc_source = path_to_final_save_location + @fedora_object.datastreams["DC"].dc_source = final_save_location_uri @fedora_object.add_datastream(content_ds) # Add checksum property to content datastream using :has_message_digest predicate diff --git a/app/models/concerns/digital_object/publishing.rb b/app/models/concerns/digital_object/publishing.rb index 1e589389b..c2f137cea 100644 --- a/app/models/concerns/digital_object/publishing.rb +++ b/app/models/concerns/digital_object/publishing.rb @@ -46,7 +46,11 @@ def execute_publish_action_for_target(publish_action, publish_target, do_ezid_up rescue Errno::ECONNREFUSED @errors.add(:publish_target, "Connection to server refused for Publish Target URL: #{publish_target.publish_target_field('publish_url')}") rescue RestClient::ExceptionWithResponse => e - @errors.add(:publish_target, "#{response&.code || 'Undefined'} response received for Publish Target URL: #{publish_target.publish_target_field('publish_url')}") + @errors.add( + :publish_target, + "#{response&.code || 'Undefined'} response received for Publish Target URL: #{publish_target.publish_target_field('publish_url')}\n"\ + "Error message: #{e.message}" + ) end success end diff --git a/app/models/digital_object/asset.rb b/app/models/digital_object/asset.rb index aed639acb..ada82b606 100644 --- a/app/models/digital_object/asset.rb +++ b/app/models/digital_object/asset.rb @@ -67,7 +67,21 @@ def run_post_validation_pre_save_logic do_poster_import if @poster_import_path.present? do_service_copy_import if @service_copy_import_path.present? && self.service_copy_location.blank? - self.dc_type = BestType.dc_type.for_file_name(original_filename) if self.dc_type == 'Unknown' # Attempt to correct dc_type for 'Unknown' dc_type DigitalObjects + # Attempt to correct dc_type for 'Unknown' dc_type DigitalObjects, based on original filename + self.dc_type = BestType.dc_type.for_file_name(original_filename) if self.dc_type == 'Unknown' + + # For ISO files, even the original filename can't tell us if they're possibly audio or video content, + # so if a service copy has been uploaded with the video then we'll determine dc type based on + # the extension of the service copy. + if self.dc_type == 'Unknown' && self.service_copy_location.present? + self.dc_type = BestType.dc_type.for_file_name(self.service_copy_location) + end + + # If we still haven't been able to determine a dc type, see if we can get the + # information from an access copy file extension (if present) + if self.dc_type == 'Unknown' && self.access_copy_location.present? + self.dc_type = BestType.dc_type.for_file_name(self.access_copy_location) + end end def run_after_create_logic @@ -96,7 +110,7 @@ def convert_upload_import_to_internal! def filesystem_location content_ds = @fedora_object.datastreams['content'] return nil unless content_ds.present? - Addressable::URI.unencode(content_ds.dsLocation).gsub(/^file:/, '') + Hyacinth::Utils::PathUtils.ds_location_to_decoded_location_uri(content_ds.dsLocation) end def access_copy_location diff --git a/lib/hyacinth/storage.rb b/lib/hyacinth/storage.rb index 90abea204..3769307b9 100644 --- a/lib/hyacinth/storage.rb +++ b/lib/hyacinth/storage.rb @@ -26,7 +26,7 @@ def self.generate_location_uri_for(pid, project, local_file_path) "#{scheme}://" + Hyacinth::Utils::PathUtils.path_to_asset_file(pid, project, File.basename(local_file_path)) when S3_SCHEME - "#{scheme}://#{HYACINTH['default_asset_home_bucket_name']}/" + + "#{scheme}://#{HYACINTH['default_asset_home_bucket_name']}/"\ "#{HYACINTH['default_asset_home_bucket_path_prefix']}/" + Hyacinth::Utils::PathUtils.path_to_asset_file(pid, project, File.basename(local_file_path)) else diff --git a/lib/hyacinth/storage/file_object.rb b/lib/hyacinth/storage/file_object.rb index 8e858526f..6ac5452cb 100644 --- a/lib/hyacinth/storage/file_object.rb +++ b/lib/hyacinth/storage/file_object.rb @@ -19,7 +19,6 @@ def filename end def size - raise "Path is: #{path}" File.size(self.path) end