From 0bca1fbd56db34332fa93f02a03428454055cc95 Mon Sep 17 00:00:00 2001 From: GatewayJ <835269233@qq.com> Date: Tue, 16 Dec 2025 19:30:50 +0800 Subject: [PATCH] fix: the method for correcting judgment headers (#1159) Co-authored-by: loverustfs --- rustfs/src/admin/router.rs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/rustfs/src/admin/router.rs b/rustfs/src/admin/router.rs index c3a63b42..a28bf29e 100644 --- a/rustfs/src/admin/router.rs +++ b/rustfs/src/admin/router.rs @@ -96,12 +96,16 @@ where } // AssumeRole - if method == Method::POST && path == "/" { - if let Some(val) = headers.get(header::CONTENT_TYPE) { - if val.as_bytes() == b"application/x-www-form-urlencoded" { - return true; - } - } + if method == Method::POST + && path == "/" + && headers + .get(header::CONTENT_TYPE) + .and_then(|v| v.to_str().ok()) + .map(|ct| ct.split(';').next().unwrap_or("").trim()) + .map(|ct| ct == "application/x-www-form-urlencoded") + .unwrap_or(false) + { + return true; } path.starts_with(ADMIN_PREFIX) || path.starts_with(RPC_PREFIX) || is_console_path(path)