Skip to content

[BUG] WebDAV 跨驱动复制报错 500 #822

Description

@xrgzs

请确认以下事项

  • 我已确认阅读并同意 AGPL-3.0 第15条
    本程序不提供任何明示或暗示的担保,使用风险由您自行承担。

  • 我已确认阅读并同意 AGPL-3.0 第16条
    无论何种情况,版权持有人或其他分发者均不对使用本程序所造成的任何损失承担责任。

  • 我确认我的描述清晰,语法礼貌,能帮助开发者快速定位问题,并符合社区规则。

  • 我已确认阅读了OpenList文档

  • 我已确认没有重复的问题或讨论。

  • 我已确认是OpenList的问题,而不是其他原因(例如 网络依赖操作)。

  • 我认为此问题必须由OpenList处理,而非第三方。

  • 我已确认这个问题在最新版本中没有被修复。

OpenList 版本(必填)

v4.0.9

使用的存储驱动(必填)

跨驱动,不限定驱动

问题描述(必填)

使用 Rclone 的 WebDAV 挂载 OpenList,从 OpenList 挂载的本机存储同步到 OpenList 挂载的任意网盘失败,报错 500

使用网页端上传、Rclone 从本地复制到 WebDAV 也正常

OpenList 后端报错 can't copy files between two storages, please use the front-end


经过排查,明确是 #721 这个 PR 所引入

WebDAV 的复制带有 conf.NoTaskKey

// copyFiles copies files and/or directories from src to dst.
//
// See section 9.8.5 for when various HTTP status codes apply.
func copyFiles(ctx context.Context, src, dst string, overwrite bool) (status int, err error) {
dstDir := path.Dir(dst)
_, err = fs.Copy(context.WithValue(ctx, conf.NoTaskKey, struct{}{}), src, dstDir)
if err != nil {
return http.StatusInternalServerError, err
}
// TODO if there are no files copy, should return 204
return http.StatusCreated, nil
}

然后 #721 的修改,检测到带有 conf.NoTaskKey 就直接 return 错误了,即没有适配跨盘复制的情况

} else if ctx.Value(conf.NoTaskKey) != nil {
return nil, fmt.Errorf("can't %s files between two storages, please use the front-end ", taskType)
}

另外 WebDAV 的 Overwrite: T 这个头部虽然传到了 copyFiles 函数,但是没有进行处理,不过在之前的使用中没有出现问题

配置文件内容(必填)

N/A

日志(可选)

Rclone 使用 -vv 参数执行同步报错:

Image

代理抓包:

Image

使用 --debug 参数运行 OpenList 程序:

Image
DEBU[2025-07-25 02:45:34]D:/temp/OpenList/internal/op/path.go:27 github.com/OpenListTeam/OpenList/v4/internal/op.GetStorageAndActualPath() use storage:  /local
DEBU[2025-07-25 02:45:34]D:/temp/OpenList/internal/op/path.go:27 github.com/OpenListTeam/OpenList/v4/internal/op.GetStorageAndActualPath() use storage:  /cr
ERRO[2025-07-25 02:45:34]D:/temp/OpenList/internal/fs/fs.go:80 github.com/OpenListTeam/OpenList/v4/internal/fs.Copy() failed copy /local/XRSYS_OSC_CI_Build_v25.7.23.1948.zip to /cr/Test: can't copy files between two storages, please use the front-end
ERRO[2025-07-25 02:45:34]D:/temp/OpenList/server/webdav.go:29 github.com/OpenListTeam/OpenList/v4/server.WebDav.func1() COPY /dav/local/XRSYS_OSC_CI_Build_v25.7.23.1948.zip can't copy files between two storages, please use the front-end

复现链接(可选)

No response

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions