Use zipinfo instead of unzip -l.
This commit is contained in:
parent
f92e3086ac
commit
d3534c1cc2
@ -92,17 +92,8 @@ class JarUnpackStrategy < UncompressedUnpackStrategy
|
|||||||
return false unless ZipUnpackStrategy.can_extract?(path: path, magic_number: magic_number)
|
return false unless ZipUnpackStrategy.can_extract?(path: path, magic_number: magic_number)
|
||||||
|
|
||||||
# Check further if the ZIP is a JAR/WAR.
|
# Check further if the ZIP is a JAR/WAR.
|
||||||
Open3.popen3("unzip", "-l", path) do |stdin, stdout, stderr, wait_thr|
|
out, _, status = Open3.capture3("zipinfo", "-1", path)
|
||||||
stdin.close_write
|
status.success? && out.split("\n").include?("META-INF/MANIFEST.MF")
|
||||||
stderr.close_read
|
|
||||||
|
|
||||||
begin
|
|
||||||
return stdout.each_line.any? { |l| l.match?(%r{\s+META-INF/MANIFEST.MF$}) }
|
|
||||||
ensure
|
|
||||||
stdout.close_read
|
|
||||||
wait_thr.kill
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user