Skip to content

Commit dc08c79

Browse files
add comment about S3Access abuse and refactor
1 parent 9e235e7 commit dc08c79

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/access.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@ pub(crate) struct TelemetryAccess;
88
#[async_trait::async_trait]
99
impl S3Access for TelemetryAccess {
1010
async fn check(&self, cx: &mut S3AccessContext<'_>) -> S3Result<()> {
11+
// to use this check to record telemetry data is an abuse of the S3Access trait, but we use it here to have a single location where we can record the requested operations
1112
telemetry::record_endpoint_call(cx.s3_op().name());
1213

13-
match cx.credentials() {
14-
Some(_) => Ok(()),
15-
None => Err(s3s::s3_error!(AccessDenied, "Signature is required")),
14+
if cx.credentials().is_none() {
15+
return Err(s3s::s3_error!(AccessDenied, "Signature is required"));
1616
}
17+
18+
Ok(())
1719
}
1820
}

0 commit comments

Comments
 (0)