open file in binary mode (#39533)
This commit is contained in:
parent
5747367a56
commit
436022883a
|
@ -94,7 +94,7 @@ def normalize(value):
|
||||||
|
|
||||||
def get_file_data(path, b64=True):
|
def get_file_data(path, b64=True):
|
||||||
"""Return the content of a file as a string, in base64 if specified."""
|
"""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:
|
if b64:
|
||||||
return base64.b64encode(file_pt.read())
|
return base64.b64encode(file_pt.read())
|
||||||
return file_pt.read()
|
return file_pt.read()
|
||||||
|
|
Reference in New Issue