Skip to content

fix(webdav): preserve canonical DavPath transforms - #28

Merged
AptS-1547 merged 2 commits into
masterfrom
fix/issue-27-davpath-canonical-transform
Aug 5, 2026
Merged

fix(webdav): preserve canonical DavPath transforms#28
AptS-1547 merged 2 commits into
masterfrom
fix/issue-27-davpath-canonical-transform

Conversation

@AptS-1547

@AptS-1547 AptS-1547 commented Aug 5, 2026

Copy link
Copy Markdown
Member

Summary

  • add canonical-native DavPath::parent and DavPath::join_child transformations
  • migrate parent collection, parent lock, and recursive mutation paths away from reparsing decoded canonical strings
  • preserve literal %, %FF, %2F, %5C, and %2E%2E backend names with stable collection trailing-slash semantics
  • document the encoded request versus decoded canonical path boundary

Boundary

DavPath::new and decode_relative_path remain the encoded request-input boundary. Canonical parent and decoded backend child transformations construct DavPath values directly and never percent-decode canonical data again.

Validation

  • cargo test -p aster_forge_webdav
  • cargo test -p aster_forge_webdav --features actix
  • cargo clippy -p aster_forge_webdav --all-targets --all-features -- -D warnings
  • cargo check --workspace
  • cargo fmt --all -- --check
  • perl scripts/check-lint-attributes.pl
  • git diff --check

Closes #27

Summary by CodeRabbit

  • 功能改进

    • 优化 WebDAV 路径处理,支持包含字面 %%2F%5C%2E%2E 的文件及目录名称。
    • 改进父路径、集合路径和递归复制操作,确保路径生成和复制结果准确可靠。
    • 拒绝空名称、... 及包含路径分隔符的非法子名称,提升路径安全性。
  • 文档

    • 补充路径编码、规范化及特殊字符处理规则。
  • 测试

    • 新增路径边界、父级锁定、目录校验和递归复制场景测试。

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@AptS-1547, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 46 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: e415ccce-8e4e-4492-8b56-2dc62e322a8a

📥 Commits

Reviewing files that changed from the base of the PR and between ae2bb19 and e1ee9fd.

📒 Files selected for processing (8)
  • crates/aster_forge_webdav/src/lock.rs
  • crates/aster_forge_webdav/src/mutation.rs
  • crates/aster_forge_webdav/src/path.rs
  • crates/aster_forge_webdav/src/resource.rs
  • crates/aster_forge_webdav/tests/guard.rs
  • crates/aster_forge_webdav/tests/mutation.rs
  • crates/aster_forge_webdav/tests/protocol.rs
  • docs/crates/aster_forge_webdav.md
📝 Walkthrough

Walkthrough

Changes

WebDAV 路径转换现在区分编码请求输入与解码后的规范路径。新增 DavPath::parent()join_child(),并迁移父级校验与递归复制逻辑。测试覆盖字面 %%2F%5C%2E%2E 名称。

WebDAV 规范路径转换

Layer / File(s) Summary
DavPath 规范转换 API
crates/aster_forge_webdav/src/path.rs, crates/aster_forge_webdav/tests/protocol.rs
DavPath 新增 parent()join_child()。子名称校验拒绝空名称、... 和路径分隔符。
父级锁与集合校验
crates/aster_forge_webdav/src/lock.rs, crates/aster_forge_webdav/src/resource.rs, crates/aster_forge_webdav/tests/guard.rs
父路径校验改用 DavPath::parent()。测试覆盖字面 %2F 目录的锁和集合匹配。
递归突变路径构造
crates/aster_forge_webdav/src/mutation.rs, crates/aster_forge_webdav/tests/mutation.rs, docs/crates/aster_forge_webdav.md
递归复制保存原始子名称,并通过 join_child() 构造目标路径。测试和文档覆盖编码边界及特殊字面名称。

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related issues

Possibly related PRs

Suggested labels: bug, documentation

Poem

规范路径不再回头解码,
%2F 保持自己的名字。
父级从 canonical 路径生长,
子项沿 join_child() 前行。
锁、集合与复制各归其位,
边界测试守住每一道门。

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 标题准确概括了本次保留规范 DavPath 变换语义的核心修改,简洁且明确。
Linked Issues check ✅ Passed 变更满足 issue #27 的要求,包括规范路径变换、父子路径迁移、特殊百分号名称保留、集合语义和测试覆盖。
Out of Scope Changes check ✅ Passed 代码、测试和文档变更均服务于 issue #27 的规范路径变换目标,未发现无关或超出范围的修改。
Docstring Coverage ✅ Passed Docstring coverage is 83.33% which is sufficient. The required threshold is 80.00%.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/issue-27-davpath-canonical-transform

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@AptS-1547

Copy link
Copy Markdown
Member Author

Downstream AsterDrive migration follow-up: AsterCommunity/AsterDrive#468

@AptS-1547
AptS-1547 force-pushed the fix/issue-27-davpath-canonical-transform branch from 7fc22aa to 3bd03ab Compare August 5, 2026 18:00

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
crates/aster_forge_webdav/src/path.rs (1)

177-177: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

明确根路径的返回值。

parent 是公共 API。文档应明确:当 self 是 mount root 时,该方法返回 None

As per coding guidelines,公共 Rust API 必须有明确边界。

建议修改
-    /// Returns the canonical parent collection without reparsing decoded path data.
+    /// Returns the canonical parent collection without reparsing decoded path data.
+    ///
+    /// Returns `None` when this path is the `WebDAV` mount root.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/aster_forge_webdav/src/path.rs` at line 177, Update the documentation
for the public parent method to explicitly state that it returns None when self
is the mount root, while retaining the existing description of returning the
canonical parent collection without reparsing decoded path data.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@crates/aster_forge_webdav/tests/guard.rs`:
- Line 699: Update the test around the directories assertion and metadata lookup
so the literal-percent path is tested independently: use a TestFileSystem
containing only "/folder%2F/" (or capture and assert the metadata query path),
ensuring an erroneous decode to "/folder/" cannot still return Ok(()). Preserve
the existing behavior assertions for the canonical "/folder%2F/" path.

---

Nitpick comments:
In `@crates/aster_forge_webdav/src/path.rs`:
- Line 177: Update the documentation for the public parent method to explicitly
state that it returns None when self is the mount root, while retaining the
existing description of returning the canonical parent collection without
reparsing decoded path data.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: c94ae4e3-3dae-4666-8be8-ef45f1b4a244

📥 Commits

Reviewing files that changed from the base of the PR and between ae2bb19 and 7fc22aa.

📒 Files selected for processing (8)
  • crates/aster_forge_webdav/src/lock.rs
  • crates/aster_forge_webdav/src/mutation.rs
  • crates/aster_forge_webdav/src/path.rs
  • crates/aster_forge_webdav/src/resource.rs
  • crates/aster_forge_webdav/tests/guard.rs
  • crates/aster_forge_webdav/tests/mutation.rs
  • crates/aster_forge_webdav/tests/protocol.rs
  • docs/crates/aster_forge_webdav.md

Comment thread crates/aster_forge_webdav/tests/guard.rs Outdated
@AptS-1547

Copy link
Copy Markdown
Member Author

Addressed both current review findings in e1ee9fd:

  • isolated the literal %2F parent-collection regression fixture so /folder/ can no longer mask a second-decode bug;
  • documented that DavPath::parent() returns None for the WebDAV mount root.

Validation:

  • cargo test -p aster_forge_webdav --test guard --test protocol
  • cargo clippy -p aster_forge_webdav --all-targets --all-features -- -D warnings
  • cargo fmt --all -- --check
  • perl scripts/check-lint-attributes.pl
  • git diff --check

@codecov

codecov Bot commented Aug 5, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.33333% with 7 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
crates/aster_forge_webdav/src/mutation.rs 74.07% 7 Missing ⚠️

📢 Thoughts on this report? Let us know!

@AptS-1547
AptS-1547 merged commit 78d7a9e into master Aug 5, 2026
6 of 7 checks passed
@AptS-1547
AptS-1547 deleted the fix/issue-27-davpath-canonical-transform branch August 5, 2026 18:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(webdav): avoid reparsing decoded canonical DavPath values

1 participant