Skip to content

Commit 6425726

Browse files
authored
MinioAdmin: conditionally decrypt response in {attach,detach}_policy APIs (#1472)
Signed-off-by: Bala.FA <bala@minio.io>
1 parent 06c7dd8 commit 6425726

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

minio/minioadmin.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -847,8 +847,21 @@ def _attach_detach_policy(
847847
"POST",
848848
command,
849849
body=encrypt(body, self._provider.retrieve().secret_key),
850+
preload_content=False,
850851
)
851-
return response.data.decode()
852+
if (
853+
command in [
854+
_COMMAND.IDP_BUILTIN_POLICY_ATTACH,
855+
_COMMAND.IDP_BUILTIN_POLICY_DETACH,
856+
] and
857+
response.status in [201, 204]
858+
):
859+
# Older MinIO servers do not return response.
860+
response.close()
861+
response.release_conn()
862+
return ""
863+
data = decrypt(response, self._provider.retrieve().secret_key)
864+
return data.decode()
852865
raise ValueError("either user or group must be set")
853866

854867
def attach_policy_ldap(

0 commit comments

Comments
 (0)