[PR #716] [CLOSED] fix: guard_root_contained walks up to existing ancestor for non-existent paths #9101

Closed
opened 2026-06-03 00:43:24 +03:00 by zhus · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/sigoden/dufs/pull/716
Author: @ErnestHysa
Created: 5/31/2026
Status: Closed

Base: mainHead: fix/upload-directory-404-regression


📝 Commits (2)

  • ac3928a fix: fill LICENSE placeholders ([yyyy] → 2026, [name of copyright owner] → sigoden)
  • 384e9bc fix: 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.

## 📋 Pull Request Information **Original PR:** https://github.com/sigoden/dufs/pull/716 **Author:** [@ErnestHysa](https://github.com/ErnestHysa) **Created:** 5/31/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/upload-directory-404-regression` --- ### 📝 Commits (2) - [`ac3928a`](https://github.com/sigoden/dufs/commit/ac3928ac7b6ceb45268411f151416e2df4a55060) fix: fill LICENSE placeholders ([yyyy] → 2026, [name of copyright owner] → sigoden) - [`384e9bc`](https://github.com/sigoden/dufs/commit/384e9bc845726f8f737f224e071c9ffc64758160) fix: guard_root_contained walks up to existing ancestor for non-existent paths ### 📊 Changes **2 files changed** (+7 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `LICENSE-APACHE` (+1 -1) 📝 `src/server.rs` (+6 -7) </details> ### 📄 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 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
zhus added the pull-request label 2026-06-03 00:43:24 +03:00
zhus closed this issue 2026-06-03 00:43:25 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sigoden/dufs#9101