mirror of
https://github.com/sigoden/dufs.git
synced 2026-06-13 12:26:42 +03:00
[PR #719] [CLOSED] fix: 修复 v0.46.0 文件上传 404 错误(非存在路径跳过符号链接检查) #9105
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/719
Author: @take7yo
Created: 6/11/2026
Status: ❌ Closed
Base:
main← Head:fix/guard-root-contained-upload📝 Commits (1)
5beac77fix: skip symlink guard for non-existent paths to restore upload functionality📊 Changes
1 file changed (+3 additions, -1 deletions)
View changed files
📝
src/server.rs(+3 -1)📄 Description
问题描述
PR #670 (commit
a118c13) 引入了guard_root_contained方法,用于防止符号链接攻击。但该方法对所有请求无条件执行检查,包括尚不存在的路径,导致文件/文件夹上传功能失效。复现步骤
--allow-all启动 dufs v0.46.0根因分析
guard_root_contained方法只检查直接父目录。当上传到新目录时:/a/b/c/file.txt不存在/a/b/c— 不存在fs::canonicalize失败true→ 返回 404在 v0.45.0 中,符号链接检查会在路径不存在时跳过(
!is_miss检查),允许上传操作创建新目录。修复方案
在
guard_root_contained调用前添加!is_miss检查:修复效果
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.
[PR #719] fix: 修复 v0.46.0 文件上传 404 错误(非存在路径跳过符号链接检查)to [PR #719] [CLOSED] fix: 修复 v0.46.0 文件上传 404 错误(非存在路径跳过符号链接检查)