Skip to content

Commit

Permalink
assert the host name for polymorphic_url to avoide url mix-ups
Browse files Browse the repository at this point in the history
  • Loading branch information
cziaarm committed Feb 7, 2024
1 parent ba3dae6 commit e545fb6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions config/initializers/hyrax-doi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,12 @@ def initialize(builder: nil)
def client
Hyrax::DOI::DataCiteClient.new(username: self.username, password: self.password, prefix: self.prefix, mode: self.mode)
end

# Override Hyrax::DOI::DataCiteRegister.work_url to ensure that the url registered uses the tenant host
def work_url(work)
account_cname = work["account_cname_tesim"]&.first
Rails.application.routes.url_helpers.polymorphic_url(work, host: account_cname)
end

end

Expand Down

0 comments on commit e545fb6

Please sign in to comment.