Skip to content

[BUG] 上传文件到天翼云盘失败,界面弹窗解析时间错误 #2936

Closed as duplicate

Description

@xuehuihui

请确认以下事项

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

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

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

  • 我已确认阅读了OpenList文档。

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

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

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

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

  • 我没有阅读这个清单,只是闭眼选中了所有的复选框,请关闭这个 Issue 。

OpenList 版本(必填)

4.2.5

使用的存储驱动(必填)

天翼云盘

问题描述(必填)

上传文件提示 : parsing time "Aug 15, 2026, 11:03:02\xe2\x80\xafPM +08" as "Jan 2, 2006 15:04:05 PM -07": cannot parse ", 11:03:02\xe2\x80\xafPM +08" as " "

Image

日志(必填)

parsing time "Aug 15, 2026, 11:03:02\xe2\x80\xafPM +08" as "Jan 2, 2006 15:04:05 PM -07": cannot parse ", 11:03:02\xe2\x80\xafPM +08" as " "

配置文件内容(必填)

Image

复现链接(可选)

No response

AI生成内容(可选)

No response

Activity

  1. xuehuihui commented on Aug 15, 2026

    @xuehuihui
    Author

    OpenList 日志:
    ERRO[2026-08-15 22:54:02] failed put /天翼云盘/nas/doc: parsing time "Aug 15, 2026, 10:54:02\xe2\x80\xafPM +08" as "Jan 2, 2006 15:04:05 PM -07": cannot parse ", 10:54:02\xe2\x80\xafPM +08" as " "
    ERRO[2026-08-15 22:54:02] PUT /dav/天翼云盘/nas/doc/rclone-test.txt parsing time "Aug 15, 2026, 10:54:02\xe2\x80\xafPM +08" as "Jan 2, 2006 15:04:05 PM -07": cannot parse ", 10:54:02\xe2\x80\xafPM +08" as " "
    WARN[2026-08-15 22:54:03] failed get /天翼云盘/nas/doc/rclone-test.txt: object not found
    ERRO[2026-08-15 22:54:03] DELETE /dav/天翼云盘/nas/doc/rclone-test.txt object not found
    调用栈:
    github.com/OpenListTeam/OpenList/v4/internal/op.Put
    /home/runner/work/OpenList/OpenList/internal/op/fs.go:712
    github.com/OpenListTeam/OpenList/v4/internal/fs.putDirectly
    /home/runner/work/OpenList/OpenList/internal/fs/put.go:110
    github.com/OpenListTeam/OpenList/v4/internal/fs.PutDirectly
    /home/runner/work/OpenList/OpenList/internal/fs/fs.go:112
    github.com/OpenListTeam/OpenList/v4/server/webdav.(*Handler).handlePut
    /home/runner/work/OpenList/OpenList/server/webdav/webdav.go:405
    github.com/OpenListTeam/OpenList/v4/server/webdav.(*Handler).ServeHTTP
    /home/runner/work/OpenList/OpenList/server/webdav/webdav.go:74
    github.com/OpenListTeam/OpenList/v4/server.ServeWebDAV
    /home/runner/work/OpenList/OpenList/server/webdav/webdav.go:47
    ...

  2. xuehuihui commented on Aug 15, 2026

    @xuehuihui
    Author

    问题分析(AI 分析, 来自kimi k3)

    天翼云盘 API 返回的时间字符串格式为 Aug 15, 2026, 10:54:02\xe2\x80\xafPM +08,其中 AM/PM 前是 Unicode 窄空格 \u202f(UTF-8 编码 \xe2\x80\xaf),而非普通空格。

    代码尝试用格式 "Jan 2, 2006 15:04:05 PM -07" 解析,期望 AM/PM 前是普通空格,遇到 \u202f 解析失败。

    关键点:源码中 drivers/189pc/help.go 的 Time.UnmarshalJSON 方法已经包含了 \u202f 替换逻辑:

    bs = strings.ReplaceAll(bs, "\u202f", " ")
    bs = strings.ReplaceAll(bs, "\u00a0", " ")

    但 PUT 上传完成后的时间解析没有走 UnmarshalJSON 这条路径,而是直接调用了 time.Parse,导致替换逻辑未生效。

    错误调用栈显示:internal/op.Put (fs.go:712) → internal/fs.putDirectly (put.go:110) → internal/fs.PutDirectly (fs.go:112) → webdav.handlePut (webdav.go:405)。时间解析失败发生在 internal/op.Put 中,即 driver 的 Put 方法内部,上传提交后天翼云盘返回的响应被直接 time.Parse 解析,未经过 Time.UnmarshalJSON 的预处理。

    受影响范围

    • 受影响操作:所有通过 WebDAV PUT 上传到天翼云盘的操作(rclone sync/copy、其他 WebDAV 客户端上传)
    • 不受影响操作:通过 OpenList Web UI 或 REST API /api/fs/put 上传(可能走不同路径)、下载、列目录(PROPFIND 返回 207 正常)
    • 受影响版本:v4.0.4 ~ v4.2.5(可能更早)
    • 实际影响:所有依赖 rclone WebDAV 上传到天翼云盘的备份脚本全部失败

    建议修复

    在 internal/op.Put 或 189pc driver 的 Put 方法中,处理天翼云盘上传提交响应时,复用 Time.UnmarshalJSON 中的窄空格替换逻辑:

    // 解析前预处理
    s = strings.ReplaceAll(s, "\u202f", " ")
    s = strings.ReplaceAll(s, "\u00a0", " ")
    v, err = time.ParseInLocation("Jan 2, 2006 3:04:05 PM -07", s, utils.CNLoc)

    或者更好的方案:将时间解析统一封装为一个 helper 函数,所有调用点复用,避免类似遗漏。

    复现步骤

    # 1. 准备测试文件
    mkdir -p /tmp/test-upload && echo "test" > /tmp/test-upload/test.txt
    
    # 2. 通过 rclone WebDAV 上传到天翼云盘
    rclone copy -v --size-only /tmp/test-upload/ "alist:/天翼云盘/nas/test/"
    
    # 3. 观察结果:报 405 Method Not Allowed
    # 4. 检查 OpenList 日志:data/log/log.log 中出现 parsing time 错误
  3. ZSXB2468 commented on Aug 16, 2026

    @ZSXB2468

    #2917 #2919
    看起来已经有有关汇报
    修复已经合并,等待正式版本发布

    着急的话可以尝试
    https://github.com/OpenListTeam/OpenList/actions/runs/31767979314

  4. tanmoumou252 commented on Aug 16, 2026

    @tanmoumou252

    SingleFileSizeOverLimit

    这是上传 2GB 的文件到天翼端口的反馈

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions