mirror of
https://github.com/inspec/inspec
synced 2024-11-23 05:03:07 +00:00
fetchers/tar: slight simplification
This commit is contained in:
parent
c24a504cb6
commit
01d7d5bf8a
1 changed files with 2 additions and 6 deletions
|
@ -34,14 +34,10 @@ module Fetchers
|
|||
def read_from_tar(file)
|
||||
return nil unless @files.include?(file)
|
||||
res = nil
|
||||
# NB `TarReader` includes `Enumerable` beginning with Ruby 2.x
|
||||
Gem::Package::TarReader.new(Zlib::GzipReader.open(@target)) do |tar|
|
||||
tar.each do |entry|
|
||||
next if entry.directory?
|
||||
# ignore symlinks for now
|
||||
next if entry.header.typeflag == '2'
|
||||
# only handle files for now
|
||||
next unless entry.file?
|
||||
next unless file == entry.full_name
|
||||
next unless entry.file? && file == entry.full_name
|
||||
res = entry.read
|
||||
break
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue