Skip to content

Commit

Permalink
don't try to register crossref dois in handle system
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Feb 9, 2020
1 parent a597b30 commit 6583071
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,14 @@ GEM
latex-decode (~> 0.0)
binding_of_caller (0.8.0)
debug_inspector (>= 0.0.1)
bolognese (1.4.3)
bolognese (1.4.5)
activesupport (>= 4.2.5, < 6)
benchmark_methods (~> 0.7)
bibtex-ruby (~> 4.1)
builder (~> 3.2, >= 3.2.2)
citeproc-ruby (~> 1.1, >= 1.1.10)
colorize (~> 0.8.1)
concurrent-ruby (~> 1.0.5)
concurrent-ruby (~> 1.1, >= 1.1.5)
csl-styles (~> 1.0, >= 1.0.1.8)
edtf (~> 3.0, >= 3.0.4)
faraday (= 0.17.0)
Expand Down Expand Up @@ -158,7 +158,7 @@ GEM
colorize (0.8.1)
commonmarker (0.17.13)
ruby-enum (~> 0.5)
concurrent-ruby (1.0.5)
concurrent-ruby (1.1.5)
countries (2.1.4)
i18n_data (~> 0.8.0)
money (~> 6.9)
Expand Down Expand Up @@ -371,7 +371,7 @@ GEM
pwqgen.rb (0.1.0)
docopt (~> 0.5)
sysrandom
rack (2.1.2)
rack (2.2.1)
rack-accept (0.4.5)
rack (>= 0.4)
rack-cors (1.1.1)
Expand Down
10 changes: 5 additions & 5 deletions app/models/concerns/crosscitable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def update_xml
end.to_h.compact

meta = from.present? ? send("read_" + from, { string: xml, doi: doi, sandbox: sandbox }.merge(read_attrs)) : {}

xml = datacite_xml

write_attribute(:xml, xml)
Expand Down Expand Up @@ -125,19 +125,19 @@ def clean_xml(string)

def well_formed_xml(string)
return nil unless string.present?

from_xml(string) || from_json(string)

string
end

def from_xml(string)
return nil unless string.start_with?('<?xml version=') || string.start_with?('<resource ')

doc = Nokogiri::XML(string) { |config| config.strict.noblanks }
doc.to_xml
end

def from_json(string)
linter = JsonLint::Linter.new
errors_array = []
Expand All @@ -156,7 +156,7 @@ def get_content_type(string)

begin
JSON.parse(string)
return "json"
"json"
rescue
"string"
end
Expand Down
6 changes: 3 additions & 3 deletions app/models/doi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1235,19 +1235,19 @@ def validatable?
end

# 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
# providers europ, and DOI registration agencies 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?

if %w(europ).include?(provider_id)
if %w(ethz europ crossref medra kisti jalc op).include?(provider_id)
UrlJob.perform_later(doi)
else
HandleJob.perform_later(doi)
end
end

def update_media
return nil unless content_url.present?
return nil if content_url.blank?

media.delete_all

Expand Down

0 comments on commit 6583071

Please sign in to comment.