fix(webdav): correct COPY/MOVE semantics, dead property persistence, and lock enforcement - #2903
Open
devLythen wants to merge 5 commits into
Open
fix(webdav): correct COPY/MOVE semantics, dead property persistence, and lock enforcement#2903devLythen wants to merge 5 commits into
devLythen wants to merge 5 commits into
Conversation
Signed-off-by: Lythen <[email protected]>
Signed-off-by: Lythen <[email protected]>
Signed-off-by: Lythen <[email protected]>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves the server’s WebDAV behavior by aligning COPY/MOVE responses and lock handling with RFC 4918 expectations, and by introducing persistent “dead property” storage so PROPPATCH/PROPFIND can round-trip custom properties across requests and MOVE operations.
Changes:
- Add shared-lock support and adjust lock confirmation to validate against the user-resolved resource path.
- Persist dead WebDAV properties in the DB (new model + migration) and surface them via PROPFIND; migrate them on MOVE.
- Fix COPY/MOVE target naming semantics by introducing a named-copy path (
CopyTo) and extending transfer-task metadata to carry the destination name.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| server/webdav/xml.go | Updates lockinfo parsing/output; changes PROPFIND body parsing/validation. |
| server/webdav/webdav.go | Adjusts request dispatch, lock confirmation logic, and property lookup call signatures. |
| server/webdav/prop.go | Implements DB-backed dead property persistence and MOVE migration. |
| server/webdav/lock.go | Extends lock model and in-memory lock system to support shared locks. |
| server/webdav/file.go | Refines MOVE/COPY filesystem behavior (destination validation, overwrite semantics, named copy). |
| internal/model/webdav_property.go | Adds DB model for persisted dead properties. |
| internal/db/db.go | Auto-migrates the new WebDAVProperty table. |
| internal/fs/fs.go | Adds CopyTo API for named COPY operations. |
| internal/fs/other.go | Extends transfer task metadata with DstName. |
| internal/fs/copy_move.go | Threads dstName through transfer execution and stream naming to preserve destination name. |
Suppressed comments (1)
server/webdav/file.go:126
copyFilesverifies thatdstDirexists but does not verify it is a directory. IfdstDirexists as a file, COPY should fail with 409 (Conflict) rather than attempting a copy into a non-collection path.
if _, err = fs.Get(ctx, dstDir, &fs.GetArgs{}); err != nil {
if errs.IsObjectNotFound(err) {
return http.StatusConflict, err
}
return http.StatusMethodNotAllowed, err
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Lythen <[email protected]>
…D body Signed-off-by: Lythen <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary / 摘要
修复 WebDAV
COPY方法稳定返回500 Internal Server Error的问题,同时修复了 COPY/MOVE 状态码语义、死属性持久化、锁路径解析和共享锁支持。COPY 同目录/跨目录、绝对/相对 Destination 均正常工作,覆盖语义符合 RFC 4918
PROPPATCH设置的自定义属性可持久化,PROPFIND可检索,MOVE时自动迁移锁检查使用用户路径解析后的实际资源路径,支持共享锁
拒绝含非法 XML 声明的 PROPFIND 请求体
This PR has breaking changes.
/ 此 PR 包含破坏性变更。
This PR changes public API, config, storage format, or migration behavior.
/ 此 PR 修改了公开 API、配置、存储格式或迁移行为。
This PR requires corresponding changes in related repositories.
/ 此 PR 需要关联仓库同步修改。
Related repository PRs / 关联仓库 PR:
Related Issues / 关联 Issue
Testing / 测试
go test ./server/webdav ./internal/fs其中
locks.fail_complex_cond_put未通过Checklist / 检查清单
/ 我已阅读 CONTRIBUTING。
/ 我确认此贡献符合仓库许可证、贡献规范和行为准则。
gofmt,go fmt, orprettierwhere applicable./ 我已按适用情况使用
gofmt、go fmt或prettier格式化变更代码。/ 我已在适用情况下请求相关维护者或代码所有者审查。