fix: ensure symlink inside serve root by sigoden · Pull Request #670 · sigoden/dufs (original) (raw)

@sigoden

@sigoden changed the titlefix: keep symlink inside serve root fix: ensure symlink inside serve root

Feb 5, 2026

take7yo added a commit to take7yo/dufs that referenced this pull request

Jun 11, 2026

@take7yo

修复内容

修复 v0.46.0 文件/文件夹上传返回 404 错误的问题。

根因

PR sigoden#670 (commit a118c13) 引入的 guard_root_contained 方法对所有请求无条件执行符号链接检查,包括尚不存在的路径。当上传到新目录时,fs::canonicalize 失败导致返回 404。

修复方案

在 guard_root_contained 调用前添加 !is_miss 检查,恢复 v0.45.0 行为:

CI 变更

v0.46.0 主要变更(相对 v0.45.0)

take7yo added a commit to take7yo/dufs that referenced this pull request

Jun 11, 2026

@take7yo

根因

PR sigoden#670 (commit a118c13) 引入的 guard_root_contained 方法对所有请求无条件执行符号链接检查,包括尚不存在的路径。当上传到新目录时,fs::canonicalize 失败导致返回 404。

修复方案

在 guard_root_contained 调用前添加 !is_miss 检查,恢复 v0.45.0 行为:

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

[ Show hidden characters]({{ revealButtonHref }})