edit detect_private_key to ignore directories instead of trying to open them as files

This commit is contained in:
Jakob Weisblat 2017-06-19 13:20:24 +02:00
parent 78818b90cd
commit ad6977c2f8
No known key found for this signature in database
GPG key ID: E30629065538B3B4

View file

@ -1,6 +1,7 @@
from __future__ import print_function
import argparse
import os
import sys
BLACKLIST = [
@ -19,6 +20,8 @@ def detect_private_key(argv=None):
private_key_files = []
for filename in args.filenames:
if os.path.isdir(filename):
continue
with open(filename, 'rb') as f:
content = f.read()
if any(line in content for line in BLACKLIST):