mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-27 15:37:02 +00:00
style: fix code formatting issues
- Fix spacing and line formatting in signer modules - Remove unnecessary blank lines - Ensure consistent code style per project standards
This commit is contained in:
@@ -12,8 +12,6 @@ const _SIGN_V4_ALGORITHM: &str = "AWS4-HMAC-SHA256";
|
|||||||
const SIGN_V2_ALGORITHM: &str = "AWS";
|
const SIGN_V2_ALGORITHM: &str = "AWS";
|
||||||
|
|
||||||
fn encode_url2path(req: &request::Builder, _virtual_host: bool) -> String {
|
fn encode_url2path(req: &request::Builder, _virtual_host: bool) -> String {
|
||||||
|
|
||||||
|
|
||||||
//path = serde_urlencoded::to_string(req.uri_ref().unwrap().path().unwrap()).unwrap();
|
//path = serde_urlencoded::to_string(req.uri_ref().unwrap().path().unwrap()).unwrap();
|
||||||
let path = req.uri_ref().unwrap().path().to_string();
|
let path = req.uri_ref().unwrap().path().to_string();
|
||||||
path
|
path
|
||||||
@@ -60,13 +58,11 @@ pub fn pre_sign_v2(
|
|||||||
.parse()
|
.parse()
|
||||||
.unwrap(),
|
.unwrap(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
req.uri(Uri::from_parts(parts).unwrap())
|
req.uri(Uri::from_parts(parts).unwrap())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn _post_pre_sign_signature_v2(policy_base64: &str, secret_access_key: &str) -> String {
|
fn _post_pre_sign_signature_v2(policy_base64: &str, secret_access_key: &str) -> String {
|
||||||
|
|
||||||
hex(hmac_sha1(secret_access_key, policy_base64))
|
hex(hmac_sha1(secret_access_key, policy_base64))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ pub fn get_signing_key(secret: &str, loc: &str, t: OffsetDateTime, service_type:
|
|||||||
let date = hmac_sha256(s.into_bytes(), t.format(&format).unwrap().into_bytes());
|
let date = hmac_sha256(s.into_bytes(), t.format(&format).unwrap().into_bytes());
|
||||||
let location = hmac_sha256(date, loc);
|
let location = hmac_sha256(date, loc);
|
||||||
let service = hmac_sha256(location, service_type);
|
let service = hmac_sha256(location, service_type);
|
||||||
|
|
||||||
hmac_sha256(service, "aws4_request")
|
hmac_sha256(service, "aws4_request")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -166,10 +166,7 @@ fn get_canonical_request(req: &request::Builder, ignored_headers: &HashMap<Strin
|
|||||||
query_params.sort_by(|a, b| a.0.cmp(&b.0));
|
query_params.sort_by(|a, b| a.0.cmp(&b.0));
|
||||||
|
|
||||||
// Build canonical query string
|
// Build canonical query string
|
||||||
let sorted_params: Vec<String> = query_params
|
let sorted_params: Vec<String> = query_params.iter().map(|(k, v)| format!("{}={}", k, v)).collect();
|
||||||
.iter()
|
|
||||||
.map(|(k, v)| format!("{}={}", k, v) )
|
|
||||||
.collect();
|
|
||||||
|
|
||||||
canonical_query_string = sorted_params.join("&");
|
canonical_query_string = sorted_params.join("&");
|
||||||
canonical_query_string = canonical_query_string.replace("+", "%20");
|
canonical_query_string = canonical_query_string.replace("+", "%20");
|
||||||
@@ -256,14 +253,13 @@ pub fn pre_sign_v4(
|
|||||||
.parse()
|
.parse()
|
||||||
.unwrap(),
|
.unwrap(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
req.uri(Uri::from_parts(parts).unwrap())
|
req.uri(Uri::from_parts(parts).unwrap())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn _post_pre_sign_signature_v4(policy_base64: &str, t: OffsetDateTime, secret_access_key: &str, location: &str) -> String {
|
fn _post_pre_sign_signature_v4(policy_base64: &str, t: OffsetDateTime, secret_access_key: &str, location: &str) -> String {
|
||||||
let signing_key = get_signing_key(secret_access_key, location, t, SERVICE_TYPE_S3);
|
let signing_key = get_signing_key(secret_access_key, location, t, SERVICE_TYPE_S3);
|
||||||
|
|
||||||
get_signature(signing_key, policy_base64)
|
get_signature(signing_key, policy_base64)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -692,7 +692,6 @@ pub struct ExpirationOptions {
|
|||||||
pub expire: bool,
|
pub expire: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct TransitionOptions {
|
pub struct TransitionOptions {
|
||||||
pub status: String,
|
pub status: String,
|
||||||
|
|||||||
Reference in New Issue
Block a user