fix(admin): remove redundant encrypt

This commit is contained in:
2025-11-30 18:29:18 +08:00
parent bc9c6cd081
commit f0c5af470e

View File

@@ -222,28 +222,12 @@ pub async fn update_rule(
)); ));
} }
// Encrypt custom_response if provided
let custom_response = if let Some(resp) = req.custom_response {
match crypto::encrypt(&resp, &state.key, &state.iv) {
Ok(encrypted) => Some(encrypted),
Err(e) => {
error!("Failed to encrypt custom response: {}", e);
return Err((
StatusCode::BAD_REQUEST,
Json(ApiError::new("Failed to encrypt custom response")),
));
}
}
} else {
None
};
match db::repositories::rules::update( match db::repositories::rules::update(
&state.db, &state.db,
id, id,
req.method_name.as_deref(), req.method_name.as_deref(),
req.action.as_deref(), req.action.as_deref(),
custom_response.as_deref(), req.custom_response.as_deref(),
req.is_enabled, req.is_enabled,
) )
.await .await