Files
e23600200a fix(drivers/webdav): retry collection stat with trailing slash (#3223)
* fix(webdav): retry collection stat with trailing slash

Some WebDAV servers (e.g. InfiniCloud) answer a PROPFIND on a collection
path without the trailing slash with a redirect the HTTP client follows
into a plain 200 HTML response instead of the required 207 Multi-Status,
so every stat of a subdirectory fails even though the directory exists.
The upstream symptom this produces: any upload into a nested directory
dies with "failed to get dir [<path>]: failed to get obj: PROPFIND
<path>: 200" — MakeDir succeeds, then the stat of the freshly created
parent dir fails, because op.GetUnwrap goes straight to driver.Get.

Retry the stat once against the canonical collection URL (slash
appended) before giving up; 404s are not retried, and paths already
carrying the slash skip the retry. The new test reproduces the quirky
server (slash-less PROPFIND -> 200 HTML, slash PROPFIND -> 207) and
fails on the unpatched driver with the exact production error.

Co-Authored-By: Claude Code <noreply@anthropic.com>

* Update drivers/webdav/driver.go

Signed-off-by: Yinan Qin <elysia-best@simplelinux.cn.eu.org>

* Update drivers/webdav/driver_test.go

Signed-off-by: Yinan Qin <elysia-best@simplelinux.cn.eu.org>

---------

Signed-off-by: Yinan Qin <elysia-best@simplelinux.cn.eu.org>
Co-authored-by: Claude Code <noreply@anthropic.com>
Co-authored-by: Yinan Qin <elysia-best@simplelinux.cn.eu.org>
Co-authored-by: Pikachu Ren <40362270+PIKACHUIM@users.noreply.github.com>
2026-10-23 22:47:56 +08:00
..
2022-09-04 22:34:54 +08:00