properly handle precondition time equal to object time

This commit is contained in:
trinity-1686a
2025-10-08 17:54:15 +02:00
parent 236af3a958
commit 42fd8583bd
2 changed files with 27 additions and 1 deletions
+3 -1
View File
@@ -845,7 +845,9 @@ impl PreconditionHeaders {
}
fn check(&self, v: &ObjectVersion, etag: &str) -> Result<Option<StatusCode>, Error> {
let v_date = UNIX_EPOCH + Duration::from_millis(v.timestamp);
// we store date with ms precision, but headers are precise to the second: truncate
// the timestamp to handle the same-second edge case
let v_date = UNIX_EPOCH + Duration::from_secs(v.timestamp / 1000);
// Implemented from https://datatracker.ietf.org/doc/html/rfc7232#section-6