Skip to content

Commit

Permalink
Move checks for schemaVersion outside of params_have_metadata_attribu…
Browse files Browse the repository at this point in the history
…tes? since it's set earlier in the cleanse method
  • Loading branch information
codycooperross committed Jan 7, 2025
1 parent 61b4388 commit 851ea91
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions app/lib/params_sanitizer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -283,9 +283,9 @@ def cleanse
add_random_id

# replace DOI, but otherwise don't touch the XML
if meta["from"] == "datacite" && !params_have_metadata_attributes?
if meta["from"] == "datacite" && !params_have_metadata_attributes? && !@params[:schemaVersion].present?
xml = replace_doi(xml, doi: @params[:doi] || meta["doi"])
elsif xml.present? || params_have_metadata_attributes?
elsif xml.present? || params_have_metadata_attributes? || @params[:schemaVersion].present?
regenerate = true
end

Expand Down Expand Up @@ -362,7 +362,6 @@ def params_have_metadata_attributes?
:rightsList,
:subjects,
:contentUrl,
:schemaVersion
].any? { |key| @params.has_key?(key) }
end

Expand Down

0 comments on commit 851ea91

Please sign in to comment.