Feat: webdav 适配 rclone (#330)
rclone在传输时会反复创建父目录, 导致cloudreve返回409, 最终导致传输失败. 因此检测如果是rclone则忽略文目录已存在错误
This commit is contained in:
parent
8c547a05fd
commit
26d4d34837
1 changed files with 5 additions and 0 deletions
|
@ -400,6 +400,11 @@ func (h *Handler) handleMkcol(w http.ResponseWriter, r *http.Request, fs *filesy
|
||||||
if r.ContentLength > 0 {
|
if r.ContentLength > 0 {
|
||||||
return http.StatusUnsupportedMediaType, nil
|
return http.StatusUnsupportedMediaType, nil
|
||||||
}
|
}
|
||||||
|
if strings.Contains(r.UserAgent(), "rclone") {
|
||||||
|
if _, ok := ctx.Value(fsctx.IgnoreConflictCtx).(bool); !ok {
|
||||||
|
ctx = context.WithValue(ctx, fsctx.IgnoreConflictCtx, true)
|
||||||
|
}
|
||||||
|
}
|
||||||
if _, err := fs.CreateDirectory(ctx, reqPath); err != nil {
|
if _, err := fs.CreateDirectory(ctx, reqPath); err != nil {
|
||||||
return http.StatusConflict, err
|
return http.StatusConflict, err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue