diff --git a/app/models/hyrax/file_metadata.rb b/app/models/hyrax/file_metadata.rb index c679164e97..d521ae8418 100644 --- a/app/models/hyrax/file_metadata.rb +++ b/app/models/hyrax/file_metadata.rb @@ -67,7 +67,7 @@ def uri_for(use:) attribute :label, ::Valkyrie::Types::Set attribute :original_filename, ::Valkyrie::Types::String attribute :mime_type, ::Valkyrie::Types::String.default(GENERIC_MIME_TYPE) - attribute :type, ::Valkyrie::Types::Set.default([Use::ORIGINAL_FILE]) + attribute :type, ::Valkyrie::Types::Set.default([Use::ORIGINAL_FILE].freeze) # Use += to add types, not << # attributes set by fits attribute :format_label, ::Valkyrie::Types::Set diff --git a/app/services/hyrax/valkyrie_upload.rb b/app/services/hyrax/valkyrie_upload.rb index 3c9fa4cc86..ea9240f679 100644 --- a/app/services/hyrax/valkyrie_upload.rb +++ b/app/services/hyrax/valkyrie_upload.rb @@ -38,7 +38,7 @@ def upload(filename:, file_set:, io:, use: Hyrax::FileMetadata::Use::ORIGINAL_FI streamfile = storage_adapter.upload(file: io, original_filename: filename, resource: file_set) file_metadata = Hyrax::FileMetadata(streamfile) file_metadata.file_set_id = file_set.id - file_metadata.type << use + file_metadata.type += [use] if use == Hyrax::FileMetadata::Use::ORIGINAL_FILE # Set file set label.