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 +4 -4
- data/lib/libis/format/identifier.rb +13 -7
- data/lib/libis/format/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1bfa82ecacff0f72386bddd49bb254c5b1a49201
|
4
|
+
data.tar.gz: 8dbc20d9263a9df5595191fcd65262a9ce171141
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a265350a34d33ea2b0d4b6565c2e5407b2ba277b60fbf7de7c40db93aac32c96f85bb284fa280f97f38391d207de6bc058c472bbc84574f82b3e222030d9294c
|
7
|
+
data.tar.gz: 5969fc9441a280cd47b5bf0030c781e98417fa6d272e233791715c548a20d336f02938f7647ef630f30cef21a1a3a514ecb0204e290530915b4356c42e96a3f0
|
@@ -76,7 +76,7 @@ module Libis
|
|
76
76
|
|
77
77
|
options ||= {}
|
78
78
|
|
79
|
-
result = {
|
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
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
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
|
data/lib/libis/format/version.rb
CHANGED