libis-format 0.9.11 → 0.9.12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5876c63db8cfe2a3b1140a9611fea4a2681511d5
4
- data.tar.gz: 6bf8da75b67128c62482f0f26fe17aafe136dd01
3
+ metadata.gz: 1bfa82ecacff0f72386bddd49bb254c5b1a49201
4
+ data.tar.gz: 8dbc20d9263a9df5595191fcd65262a9ce171141
5
5
  SHA512:
6
- metadata.gz: 3c1e3c7fa3fc63d7d18a4a1023103a40cb74bb71b25495983fc8a13f062eb9792cf77c8ce76682d3daed0d7e55116a8e8d6b905112d2960eb4b6958ab0ab76e7
7
- data.tar.gz: 60b28a0ec4d8bcc1e13129d945e919745094c44f97c207e732df4c3c655f47d01186fab28655d8c627dd10190b5bd76cda83903d56ca448bfec3dec92b23b4eb
6
+ metadata.gz: a265350a34d33ea2b0d4b6565c2e5407b2ba277b60fbf7de7c40db93aac32c96f85bb284fa280f97f38391d207de6bc058c472bbc84574f82b3e222030d9294c
7
+ data.tar.gz: 5969fc9441a280cd47b5bf0030c781e98417fa6d272e233791715c548a20d336f02938f7647ef630f30cef21a1a3a514ecb0204e290530915b4356c42e96a3f0
@@ -76,7 +76,7 @@ module Libis
76
76
 
77
77
  options ||= {}
78
78
 
79
- result = { messages: [] }
79
+ result = {messages: []}
80
80
 
81
81
  # use FIDO
82
82
  # Note: FIDO does not always do a good job, mainly due to lacking container inspection.
@@ -121,7 +121,7 @@ module Libis
121
121
  warn 'Droid found multiple matches; using first match only' if droid_output.size > 1
122
122
  result.clear
123
123
  droid_output = droid_output.first
124
- result[:mimetype] = droid_output[:mime_type].to_s.split(/[\s,]+/).find {|x| x =~ /.*\/.*/}
124
+ result[:mimetype] = droid_output[:mime_type].to_s.split(/[\s,]+/).find { |x| x =~ /.*\/.*/ }
125
125
  result[:matchtype] = droid_output[:method]
126
126
  result[:puid] = droid_output[:puid]
127
127
  result[:format_name] = droid_output[:format_name]
@@ -165,11 +165,17 @@ module Libis
165
165
  doc = ::Libis::Tools::XmlDocument.open file
166
166
  xml_validations.each do |mime, xsd_file|
167
167
  next unless xsd_file
168
- if doc.validates_against?(xsd_file)
169
- log_msg result, :debug, "XML file validated against XML Schema: #{xsd_file}"
170
- result[:mimetype] = mime
171
- result[:puid] = nil
172
- result = ::Libis::Format::TypeDatabase.enrich(result, PUID: :puid, MIME: :mimetype)
168
+ begin
169
+ if doc.validates_against?(xsd_file)
170
+ log_msg result, :debug, "XML file validated against XML Schema: #{xsd_file}"
171
+ result[:mimetype] = mime
172
+ result[:puid] = nil
173
+ result = ::Libis::Format::TypeDatabase.enrich(result, PUID: :puid, MIME: :mimetype)
174
+ end
175
+ rescue
176
+ # Do nothing - probably Nokogiri chrashed during validation.
177
+ # Could have many causes (remote schema: firewall, network, link rot, ...; schema syntax error; ...)
178
+ # so we just ignore and continue.
173
179
  end
174
180
  end
175
181
  result
@@ -1,5 +1,5 @@
1
1
  module Libis
2
2
  module Format
3
- VERSION = '0.9.11'
3
+ VERSION = '0.9.12'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libis-format
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.11
4
+ version: 0.9.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kris Dekeyser