From bcb95d14623f1ddd8a836ce0c9616cec8fe14056 Mon Sep 17 00:00:00 2001 From: Alex Ling Date: Sun, 31 May 2020 15:14:17 +0000 Subject: [PATCH] Make `validate_archive` more thorough --- shard.lock | 2 +- src/archive.cr | 6 ++++++ src/util.cr | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/shard.lock b/shard.lock index 74ad3e1..a58d6b6 100644 --- a/shard.lock +++ b/shard.lock @@ -6,7 +6,7 @@ shards: archive: github: hkalexling/archive.cr - version: 0.1.0 + version: 0.2.0 baked_file_system: github: schovi/baked_file_system diff --git a/src/archive.cr b/src/archive.cr index afdf143..29dedfb 100644 --- a/src/archive.cr +++ b/src/archive.cr @@ -50,4 +50,10 @@ class ArchiveFile e.read end end + + def check + if @archive_file.is_a? Archive::File + @archive_file.as(Archive::File).check + end + end end diff --git a/src/util.cr b/src/util.cr index cfdd2ea..0d6a993 100644 --- a/src/util.cr +++ b/src/util.cr @@ -87,6 +87,7 @@ end def validate_archive(path : String) : Exception? file = ArchiveFile.new path + file.check file.close return rescue e