Skip to content

Commit b36556d

Browse files
Merge pull request #477 from cedarcode/nt--start-the-server-even-if-no-metadata
Prevent the server from crashing when the metadata file is missing
2 parents 37ac335 + 78ba0d6 commit b36556d

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

spec/conformance/conformance_cache_store.rb

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@ class ConformanceCacheStore < FidoMetadata::TestCacheStore
88
FILENAME = "metadata.zip"
99

1010
def setup_authenticators
11-
puts("#{FILENAME} not found, this will affect Metadata Service Test results.") unless File.exist?(FILENAME)
12-
13-
Zip::File.open(FILENAME).glob("metadataStatements/*.json") do |file|
14-
json = JSON.parse(file.get_input_stream.read)
15-
statement = FidoMetadata::Statement.from_json(json)
16-
identifier = statement.aaguid || statement.attestation_certificate_key_identifiers.first
17-
write("statement_#{identifier}", statement)
11+
if File.exist?(FILENAME)
12+
Zip::File.open(FILENAME).glob("metadataStatements/*.json") do |file|
13+
json = JSON.parse(file.get_input_stream.read)
14+
statement = FidoMetadata::Statement.from_json(json)
15+
identifier = statement.aaguid || statement.attestation_certificate_key_identifiers.first
16+
write("statement_#{identifier}", statement)
17+
end
18+
else
19+
puts("#{FILENAME} not found, this will affect Metadata Service Test results.")
1820
end
1921
end
2022

0 commit comments

Comments
 (0)