Skip to content

Commit 0c505b2

Browse files
committed
Close the certificate file after reading it
1 parent 1e671fe commit 0c505b2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

rest_framework_sso/keys.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ def read_key_file(file_name):
1414
file_path = os.path.abspath(os.path.join(api_settings.KEY_STORE_ROOT, file_name))
1515
else:
1616
file_path = os.path.abspath(file_name)
17-
return open(file_path, 'rb').read()
17+
with open(file_path, 'rb') as file_obj:
18+
return file_obj.read()
1819

1920

2021
def get_key_id(file_name):

0 commit comments

Comments
 (0)