X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/b629d9e88ad0c6e62018a8fb4768013975eccc70..415910149bed2eef6ae818b7c059d413934df06e:/services/api/app/models/collection.rb diff --git a/services/api/app/models/collection.rb b/services/api/app/models/collection.rb index 39d56997a0..292cf34ccb 100644 --- a/services/api/app/models/collection.rb +++ b/services/api/app/models/collection.rb @@ -27,6 +27,7 @@ class Collection < ArvadosModel before_validation :check_manifest_validity before_validation :check_signatures before_validation :strip_signatures_and_update_replication_confirmed + before_validation :name_null_if_empty validate :ensure_pdh_matches_manifest_text validate :ensure_storage_classes_desired_is_not_empty validate :ensure_storage_classes_contain_non_empty_strings @@ -38,7 +39,7 @@ class Collection < ArvadosModel around_update :manage_versioning, unless: :is_past_version? api_accessible :user, extend: :common do |t| - t.add :name + t.add lambda { |x| x.name || "" }, as: :name t.add :description t.add :properties t.add :portable_data_hash @@ -77,6 +78,7 @@ class Collection < ArvadosModel # correct timestamp in signed_manifest_text. 'manifest_text' => ['manifest_text', 'trash_at', 'is_trashed'], 'unsigned_manifest_text' => ['manifest_text'], + 'name' => ['name'], ) end @@ -195,6 +197,12 @@ class Collection < ArvadosModel end end + def name_null_if_empty + if name == "" + self.name = nil + end + end + def set_file_names if self.manifest_text_changed? self.file_names = manifest_files @@ -513,7 +521,7 @@ class Collection < ArvadosModel joins("JOIN collections ON links.head_uuid = collections.uuid"). order("links.created_at DESC") - docker_image_formats = Rails.configuration.Containers.SupportedDockerImageFormats + docker_image_formats = Rails.configuration.Containers.SupportedDockerImageFormats.keys.map(&:to_s) if (docker_image_formats.include? 'v1' and docker_image_formats.include? 'v2') or filter_compatible_format == false