This is an automated email from the ASF dual-hosted git repository.
Xuanwo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/opendal.git
The following commit(s) were added to refs/heads/main by this push:
new af891104fe fix(services/oss): honor date conditions in stat requests
(#9281)
af891104fe is described below
commit af891104fe6fa5f66684fc2c52d02e488deee945
Author: Xuanwo <[email protected]>
AuthorDate: Fri Nov 27 22:55:57 2026 +0800
fix(services/oss): honor date conditions in stat requests (#9281)
Forward If-Modified-Since and If-Unmodified-Since through the shared
HeadObject request builder for ordinary and presigned stat. Advertise
both stat capabilities and update the generated service catalog.
---
core/services/oss/src/backend.rs | 2 ++
core/services/oss/src/core.rs | 6 ++++++
website/data/capabilities.json | 2 ++
3 files changed, 10 insertions(+)
diff --git a/core/services/oss/src/backend.rs b/core/services/oss/src/backend.rs
index 407a322e10..35086de1a5 100644
--- a/core/services/oss/src/backend.rs
+++ b/core/services/oss/src/backend.rs
@@ -630,6 +630,8 @@ impl Builder for OssBuilder {
stat: true,
stat_with_if_match: true,
stat_with_if_none_match: true,
+ stat_with_if_modified_since: true,
+ stat_with_if_unmodified_since: true,
stat_with_override_cache_control: true,
stat_with_override_content_disposition: true,
stat_with_version: true,
diff --git a/core/services/oss/src/core.rs b/core/services/oss/src/core.rs
index bc7fba4b6a..708a39bb10 100644
--- a/core/services/oss/src/core.rs
+++ b/core/services/oss/src/core.rs
@@ -482,6 +482,12 @@ impl OssCore {
if let Some(if_none_match) = args.if_none_match() {
req = req.header(IF_NONE_MATCH, if_none_match);
}
+ if let Some(if_modified_since) = args.if_modified_since() {
+ req = req.header(IF_MODIFIED_SINCE,
if_modified_since.format_http_date());
+ }
+ if let Some(if_unmodified_since) = args.if_unmodified_since() {
+ req = req.header(IF_UNMODIFIED_SINCE,
if_unmodified_since.format_http_date());
+ }
let req = req
.extension(Operation::Stat)
diff --git a/website/data/capabilities.json b/website/data/capabilities.json
index a539ba8115..b151200d3b 100644
--- a/website/data/capabilities.json
+++ b/website/data/capabilities.json
@@ -3180,7 +3180,9 @@
"shared": true,
"stat": true,
"stat_with_if_match": true,
+ "stat_with_if_modified_since": true,
"stat_with_if_none_match": true,
+ "stat_with_if_unmodified_since": true,
"stat_with_override_cache_control": true,
"stat_with_override_content_disposition": true,
"stat_with_version": true,