mirror of
https://github.com/sigoden/dufs.git
synced 2026-06-07 15:59:03 +03:00
[PR #716] [CLOSED] fix: guard_root_contained walks up to existing ancestor for non-existent paths #9101
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/sigoden/dufs/pull/716
Author: @ErnestHysa
Created: 5/31/2026
Status: ❌ Closed
Base:
main← Head:fix/upload-directory-404-regression📝 Commits (2)
ac3928afix: fill LICENSE placeholders ([yyyy] → 2026, [name of copyright owner] → sigoden)384e9bcfix: guard_root_contained walks up to existing ancestor for non-existent paths📊 Changes
2 files changed (+7 additions, -8 deletions)
View changed files
📝
LICENSE-APACHE(+1 -1)📝
src/server.rs(+6 -7)📄 Description
Summary
Fix regression in v0.46.0 where directory upload via drag-and-drop returns 404.
Root Cause
When uploading a file to a non-existent subdirectory (e.g., PUT /subdir/file.txt where subdir/ does not exist), the old guard_root_contained() only checked one level of parent. If the parent did not exist, it tried to canonicalize a non-existent path, causing is_root_contained to return false and trigger a 404.
Fix
Changed guard_root_contained() to walk up the directory tree until an existing ancestor is found, then canonicalize that path. This ensures that uploading files to new subdirectories works correctly.
Testing
The fix was validated against issue #714, which provides detailed reproduction steps.
Fixes #714
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.