Skip to content

Commit 9f6b9f6

Browse files
committed
fix: close file after read
Signed-off-by: Árpád Csepi <csepi.arpad@outlook.com>
1 parent 23296a2 commit 9f6b9f6

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

dir-sdk-python/agntcy/dir_sdk/client/dirctl/verification.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,13 @@ def _verify_with_oidc(
125125

126126
def parse_verify_response(output_path: str) -> sign_v1.VerifyResponse:
127127
try:
128-
output = open(output_path, "rb").read()
129-
json_data = json.loads(output.decode("utf-8"))
128+
with open(output_path, "rb") as f:
129+
output = f.read().decode("utf-8")
130+
131+
json_data = json.loads(output)
130132
response = sign_v1.VerifyResponse()
131133
json_format.ParseDict(json_data, response)
134+
132135
return response
133136
except (json.JSONDecodeError, UnicodeDecodeError) as e:
134137
msg = f"Failed to parse verification response: {e}"

0 commit comments

Comments
 (0)