open file in binary mode (#39533)

This commit is contained in:
Emmanuel Cazenave 2020-02-04 17:26:51 +01:00
parent 5747367a56
commit 436022883a
1 changed files with 1 additions and 1 deletions

View File

@ -94,7 +94,7 @@ def normalize(value):
def get_file_data(path, b64=True):
"""Return the content of a file as a string, in base64 if specified."""
with open(path, 'r') as file_pt:
with open(path, 'rb') as file_pt:
if b64:
return base64.b64encode(file_pt.read())
return file_pt.read()