Skip to content

Commit

Permalink
don't set url for crossref dois. datacite/levriero#56
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Jun 18, 2019
1 parent f9f241d commit a409a01
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions app/models/concerns/helpable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,12 @@ def get_dois(options={})
def get_doi(options={})
return OpenStruct.new(body: { "errors" => [{ "title" => "DOI missing" }] }) unless options[:doi].present?

url = (Rails.env.production? || options[:agency] == "Crossref") ? "https://doi.org" : "https://handle.test.datacite.org"
url += "/#{options[:doi]}"
response = Maremma.get(url, ssl_self_signed: true, timeout: 10)
url = Rails.env.production? ? "https://doi.org" : "https://handle.test.datacite.org"
url += "/api/handles/#{options[:doi]}"
response = Maremma.get(url, username: "300%3A#{ENV['HANDLE_USERNAME']}", password: ENV['HANDLE_PASSWORD'], ssl_self_signed: true, timeout: 10)

if response.status == 200
response.headers[:location]
response
else
text = "Error " + response.body["errors"].inspect

Expand Down
4 changes: 2 additions & 2 deletions app/models/doi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -560,9 +560,9 @@ def validatable?
# update URL in handle system for registered and findable state
# providers europ and ethz do their own handle registration, so fetch url from handle system instead
def update_url
return nil if current_user.nil? || !is_registered_or_findable?
return nil if current_user.nil? || !is_registered_or_findable? || %w(Crossref).include?(agency)

if %w(europ ethz crossref).include?(provider_id) || %w(Crossref).include?(agency)
if %w(europ ethz).include?(provider_id)
UrlJob.perform_later(doi)
else
HandleJob.perform_later(doi)
Expand Down

0 comments on commit a409a01

Please sign in to comment.