Mola-maker opened a new pull request, #9079:
URL: https://github.com/apache/opendal/pull/9079
# Which issue does this PR close?
Closes #9078.
# Rationale for this change
`OpendalMetaData::etag` returns `None` when the OpenDAL metadata has no
ETag, and that also disables dav-server's default ETag derived from length and
modification time. A server on `services::Fs` therefore sends no ETag at all.
# What changes are included in this PR?
- When the backend has no ETag, `etag()` returns `default_etag()`. It uses
the same derivation as dav-server 0.12's default `DavMetaData::etag`:
microseconds since the epoch, formatted as `{len:x}-{t:x}` for non-empty files
and `{t:x}` otherwise.
- A backend ETag still takes precedence, and an invalid backend ETag is
still dropped, as before. The existing `test_file_etag` cases are unchanged.
- Add unit tests for the fallback on files and directories, for the case
with no modification time, and for backend precedence.
Like dav-server's own default for `LocalFs`, this tag is only as precise as
the backend's modification time. `services::Fs` reports sub-second times.
Verification (Windows 11, rustc 1.99.1):
- The fallback test fails on main and passes with this change.
- `cargo test --no-fail-fast` in `integrations/dav-server`: 2 unit tests, 28
in `tests/test.rs`, 5 in `tests/webdav_loopback.rs` and 2 doc tests pass.
- `cargo clippy --all-targets -- -D warnings`: clean on Windows.
Linux-target clippy on the library is clean; with `--all-targets` it cannot run
here because aws-lc-sys needs a C cross-compiler.
- End to end, HEAD and GET now return `etag: "5-6611a6ec5c634"`.
- The webdav behavior suite against `dav-server-opendalfs` on Fs went from
130 to 141 passed. The 2 remaining failures are a non-atomic `Overwrite: F`
MOVE and the missing PROPPATCH support.
# Are there any user-facing changes?
Servers on backends without native ETags now send ETags derived from size
and modification time.
# Breaking changes
# AI Usage Statement
- Harness: Claude Code
- Model: Anthropic Claude
- Effort: default
- Role: Found the bug by running OpenDAL's webdav behavior suite against
`dav-server-opendalfs` on Fs, wrote the fix and the tests, and ran the checks
above. A separate review pass checked that the formula matches dav-server's
default and looked at the validator-strength trade-off.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]