From 234247586e19644a019a0fa07b7a66c5435cc4ea Mon Sep 17 00:00:00 2001 From: Scott Smith Date: Tue, 29 Nov 2016 21:28:22 -0800 Subject: [PATCH] Properly decode file contents. --- pre_commit_hooks/detect_aws_credentials.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pre_commit_hooks/detect_aws_credentials.py b/pre_commit_hooks/detect_aws_credentials.py index 4c51546..e7cafd8 100644 --- a/pre_commit_hooks/detect_aws_credentials.py +++ b/pre_commit_hooks/detect_aws_credentials.py @@ -29,7 +29,7 @@ def check_file_for_aws_keys(filenames, keys): for filename in filenames: with open(filename, 'r') as content: - text_body = content.read() + text_body = content.read().decode('utf-8') if any(key in text_body for key in keys): # naively match the entire file, low chance of incorrect collision bad_files.append(filename)