Forced utf-8 encoding when loading common passwords in CommonPasswordValidator.
Previously we used `decode()` which defaults to utf-8. This change
restores previous behavior.
Follow up to 28eac41510
.
This commit is contained in:
parent
a2c31e12da
commit
2007e11d70
|
@ -171,7 +171,7 @@ class CommonPasswordValidator:
|
||||||
|
|
||||||
def __init__(self, password_list_path=DEFAULT_PASSWORD_LIST_PATH):
|
def __init__(self, password_list_path=DEFAULT_PASSWORD_LIST_PATH):
|
||||||
try:
|
try:
|
||||||
with gzip.open(password_list_path, 'rt') as f:
|
with gzip.open(password_list_path, 'rt', encoding='utf-8') as f:
|
||||||
self.passwords = {x.strip() for x in f}
|
self.passwords = {x.strip() for x in f}
|
||||||
except OSError:
|
except OSError:
|
||||||
with open(password_list_path) as f:
|
with open(password_list_path) as f:
|
||||||
|
|
Loading…
Reference in New Issue