Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refreeze FileMetadata type with note to not << #5944

Merged
merged 1 commit into from
Jan 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/models/hyrax/file_metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion app/services/hyrax/valkyrie_upload.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down