mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-24 16:01:42 +00:00
make to_i64 more resilient and clearer error message on client setup
This commit is contained in:
@@ -415,7 +415,7 @@ async fn connect_slack(cookies: Cookies) -> error::Result<Redirect> {
|
||||
let mut client = OAUTH_CLIENTS
|
||||
.slack
|
||||
.as_ref()
|
||||
.ok_or_else(|| error::Error::BadRequest("slack client not setup".to_string()))?
|
||||
.ok_or_else(|| error::Error::BadRequest("slack client not setup. See: https://docs.windmill.dev/docs/misc/setup_oauth#slack".to_string()))?
|
||||
.to_owned();
|
||||
let state = State::new_random();
|
||||
|
||||
@@ -616,7 +616,7 @@ async fn connect_slack_callback(
|
||||
let client = OAUTH_CLIENTS
|
||||
.slack
|
||||
.as_ref()
|
||||
.ok_or_else(|| error::Error::BadRequest("slack client not setup".to_string()))?
|
||||
.ok_or_else(|| error::Error::BadRequest("slack client not setup. See: https://docs.windmill.dev/docs/misc/setup_oauth#slack".to_string()))?
|
||||
.to_owned();
|
||||
let token =
|
||||
exchange_code::<SlackTokenResponse>(callback, &cookies, client, &HTTP_CLIENT, None).await?;
|
||||
|
||||
@@ -209,6 +209,11 @@ pub struct ListScriptQuery {
|
||||
|
||||
pub fn to_i64(s: &str) -> crate::error::Result<i64> {
|
||||
let v = hex::decode(s)?;
|
||||
if v.len() < 8 {
|
||||
return Err(crate::error::Error::BadRequest(format!(
|
||||
"hex string did not decode to an u64: {s}",
|
||||
)));
|
||||
}
|
||||
let nb: u64 = u64::from_be_bytes(
|
||||
v[0..8]
|
||||
.try_into()
|
||||
|
||||
Reference in New Issue
Block a user