Skip to content

Commit

Permalink
Merge pull request #1958 from datadryad/exception
Browse files Browse the repository at this point in the history
Exception fix attempt
  • Loading branch information
ahamelers authored Dec 23, 2024
2 parents 5b03f83 + 36b853c commit 15dc5ad
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/controllers/stash_api/datasets_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,7 @@ def duplicate_resource
nr.current_editor_id = @user.id
nr.save!
rescue ActiveRecord::RecordNotUnique
@resource.identifier.reload
nr = @resource.identifier.latest_resource unless @resource.identifier.latest_resource_id == @resource.id
nr ||= @resource.amoeba_dup
nr.current_editor_id = @user.id
Expand Down
1 change: 1 addition & 0 deletions app/helpers/stash_engine/metadata_entry_pages_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ def duplicate_resource
@new_res.current_editor_id = current_user&.id
@new_res.save!
rescue ActiveRecord::RecordNotUnique
@resource.identifier.reload
@new_res = @resource.identifier.latest_resource unless @resource.identifier.latest_resource_id == @resource.id
@new_res ||= @resource.amoeba_dup
@new_res.current_editor_id = current_user&.id
Expand Down

0 comments on commit 15dc5ad

Please sign in to comment.