Fix JAR detection.
This commit is contained in:
		
							parent
							
								
									1d387f0b96
								
							
						
					
					
						commit
						979e6674cf
					
				@ -125,8 +125,10 @@ class LuaRockUnpackStrategy < 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 LuaRocks package.
 | 
					    # Check further if the ZIP is a LuaRocks package.
 | 
				
			||||||
    out, _, status = Open3.capture3("zipinfo", "-1", path)
 | 
					    out, = Open3.capture3("zipinfo", "-1", path)
 | 
				
			||||||
    status.success? && out.split("\n").any? { |line| line.match?(%r{\A[^/]+.rockspec\Z}) }
 | 
					    out.encode(Encoding::UTF_8, invalid: :replace)
 | 
				
			||||||
 | 
					       .split("\n")
 | 
				
			||||||
 | 
					       .any? { |line| line.match?(%r{\A[^/]+.rockspec\Z}) }
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -135,8 +137,10 @@ 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.
 | 
				
			||||||
    out, _, status = Open3.capture3("zipinfo", "-1", path)
 | 
					    out, = Open3.capture3("zipinfo", "-1", path)
 | 
				
			||||||
    status.success? && out.split("\n").include?("META-INF/MANIFEST.MF")
 | 
					    out.encode(Encoding::UTF_8, invalid: :replace)
 | 
				
			||||||
 | 
					       .split("\n")
 | 
				
			||||||
 | 
					       .include?("META-INF/MANIFEST.MF")
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user