sync s3s, return UnauthorizedAccess error code when credentials is none

This commit is contained in:
weisd
2025-02-25 10:05:03 +08:00
parent dae6616720
commit 9f57ea9bb6
7 changed files with 26 additions and 28 deletions
+2 -2
View File
@@ -19,7 +19,7 @@ impl IAMAuth {
impl S3Auth for IAMAuth {
async fn get_secret_key(&self, access_key: &str) -> S3Result<SecretKey> {
if access_key.is_empty() {
return Err(s3_error!(NotSignedUp, "Your account is not signed up"));
return Err(s3_error!(UnauthorizedAccess, "Your account is not signed up"));
}
if let Ok(key) = self.simple_auth.get_secret_key(access_key).await {
@@ -32,6 +32,6 @@ impl S3Auth for IAMAuth {
}
}
Err(s3_error!(NotSignedUp, "Your account is not signed up2"))
Err(s3_error!(UnauthorizedAccess, "Your account is not signed up2"))
}
}
+1 -4
View File
@@ -67,10 +67,7 @@ fn match_for_io_error(err_status: &Status) -> Option<&std::io::Error> {
}
}
err = match err.source() {
Some(err) => err,
None => return None,
};
err = err.source()?;
}
}
+1 -1
View File
@@ -52,7 +52,7 @@ impl S3Access for FS {
);
if cx.credentials().is_none() {
return Err(s3_error!(AccessDenied, "Signature is required"));
return Err(s3_error!(UnauthorizedAccess, "Signature is required"));
};
// TODO: FIXME: check auth
+1
View File
@@ -550,6 +550,7 @@ impl S3 for FS {
.map(|v| Bucket {
creation_date: v.created.map(Timestamp::from),
name: Some(v.name.clone()),
..Default::default()
})
.collect();