Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unicode on RHS in ini scan #143

Merged
merged 2 commits into from
Mar 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions detect_secrets/plugins/common/ini_file_parser.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import unicode_literals

import configparser
import re

Expand All @@ -20,7 +22,8 @@ def __init__(self, file, add_header=False, exclude_lines_regex=None):
try:
# python2.7 compatible
self.parser.optionxform = unicode
except NameError:
except NameError: # pragma: no cover
# python3 compatible
self.parser.optionxform = str

self.exclude_lines_regex = exclude_lines_regex
Expand All @@ -34,7 +37,7 @@ def __init__(self, file, add_header=False, exclude_lines_regex=None):
try:
# python2.7 compatible
self.parser.read_string(unicode(content))
except NameError:
except NameError: # pragma: no cover
# python3 compatible
self.parser.read_string(content)

Expand Down
3 changes: 3 additions & 0 deletions test_data/config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,6 @@ keyB = 456789123
keyC =

password = 12345678901234 # pragma: whitelist secret

# unicode
foo=bår