fix: create directory now ignore conflict error, it will return the existed folder

This commit is contained in:
HFO4
2022-04-21 13:58:22 +08:00
parent 86877aef4b
commit 71df067a76
5 changed files with 21 additions and 32 deletions

View File

@@ -400,11 +400,7 @@ func (h *Handler) handleMkcol(w http.ResponseWriter, r *http.Request, fs *filesy
if r.ContentLength > 0 {
return http.StatusUnsupportedMediaType, nil
}
if strings.Contains(r.UserAgent(), "rclone") {
if _, ok := ctx.Value(fsctx.IgnoreDirectoryConflictCtx).(bool); !ok {
ctx = context.WithValue(ctx, fsctx.IgnoreDirectoryConflictCtx, true)
}
}
if _, err := fs.CreateDirectory(ctx, reqPath); err != nil {
return http.StatusConflict, err
}