fix: map IAM not-found errors to 404 in InfoCannedPolicy and RemoveUser

Merge the approved fix from pull request #8134.
This commit is contained in:
chapman
2026-09-28 18:38:20 +08:00
committed by GitHub
parent 6ebc78d115
commit 6300fbe74f
2 changed files with 2 additions and 4 deletions
+1 -1
View File
@@ -320,7 +320,7 @@ impl Operation for InfoCannedPolicy {
error = ?e,
"admin policy state"
);
S3Error::with_message(S3ErrorCode::InternalError, e.to_string())
iam_error_to_s3_error(e)
})?;
let body = serde_json::to_vec(&pd).map_err(|e| s3_error!(InternalError, "failed to serialize response: {:?}", e))?;
+1 -3
View File
@@ -510,9 +510,7 @@ impl Operation for RemoveUser {
return Err(s3_error!(InternalError, "iam is not initialized"));
};
let (is_temp, _) = iam_store.is_temp_user(ak).await.map_err(|e| {
S3Error::with_message(S3ErrorCode::InternalError, format!("failed to query temporary user state: {e}"))
})?;
let (is_temp, _) = iam_store.is_temp_user(ak).await.map_err(iam_error_to_s3_error)?;
if is_temp {
return Err(s3_error!(InvalidArgument, "cannot remove a temporary user"));