jfrog/jfrog-spring-tools

File handle leak in zip_file

Closed this issue · 1 comments

In zip_file, this block is leaking a file

if acceptable_filename(file_name):
    next_file = jarfile.open(file_name, "r") 
    test_file(next_file, os.path.join(rel_path, file_name), silent_mode)`

It should be like this:

if acceptable_filename(file_name):  
    with jarfile.open(file_name, "r") as next_file:  
        test_file(next_file, os.path.join(rel_path, file_name), silent_mode)`

Edit: fixed formatting

Thanks @DevonMiller-tfo ,
fixed in the latest commit