Closed cowlicks closed 1 year ago
Hey @cowlicks, thanks for submitting this issue. We'll look into it.
@cowlicks Ok, I figured it out. If you send dates with subsecond nanos, then S3 will silently ignore it. If you update your code above to this, then it should start working as expected:
#[tokio::test]
async fn bug_report() -> Result<()> {
dotenvy::dotenv().ok();
let config = ::aws_config::load_from_env().await;
let client = aws_sdk_s3::Client::new(&config);
let key = "my_key_that_exists.json";
let bucket = "my-bucket";
let if_modified_since_input: aws_sdk_s3::primitives::DateTime =
std::time::SystemTime::now().into();
if_modified_since_input.set_subsec_nanos(0);
let resp = client
.get_object()
.bucket(bucket)
.key(key)
.if_modified_since(if_modified_since_input)
.send()
.await?;
assert!(resp.last_modified.unwrap() > if_modified_since_input);
dbg!(resp);
Ok(())
}
@jmklix I would consider this a bug on S3's side. They should either accept datetimes with nanosecond precision or respond with a 400 explaining that they don't allow subsecond precision. Would you be able to check if other SDKs have this same issue and file a ticket with the S3 team?
@jmklix I filed an issue with the S3 maintainers, ticket number is V925584723.
It appears our date time formatting is incorrect:
this is fixed in S3 0.35 (currently queued up to release)
Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.
Fix verified
Describe the bug
When using
GetObjectFluentBuilder.if_modified_since
orset_if_modified_since
to get an object, the object is always returned. I tried both methods, and tried setting theinput
to be both before and after thelast_modified
date of the object (fromGetObjectOutput.last_modified
). In every case, the object is returned.Expected Behavior
The
set_if_modified_since
andif_modified_methods
should only return an object if the object was modified after the provided input.Current Behavior
the
set_if_modified_since
andif_modified_methods
do nothing.Reproduction Steps
Possible Solution
No response
Additional Information/Context
No response
Version
Environment details (OS name and version, etc.)
arch linux
Logs