From 1fe26bff9afbc4c8fc77f2673b60aa80edc40e1f Mon Sep 17 00:00:00 2001 From: "Tursom K. Ulefits" <33368546+tursom@users.noreply.github.com> Date: Wed, 10 Sep 2025 20:57:21 +0800 Subject: [PATCH] feat(local): auto create recycle dir if not exists (#1244) --- drivers/local/driver.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/local/driver.go b/drivers/local/driver.go index df357536..0a78e12d 100644 --- a/drivers/local/driver.go +++ b/drivers/local/driver.go @@ -374,6 +374,13 @@ func (d *Local) Remove(ctx context.Context, obj model.Obj) error { err = os.Remove(obj.GetPath()) } } else { + if !utils.Exists(d.RecycleBinPath) { + err = os.MkdirAll(d.RecycleBinPath, 0755) + if err != nil { + return err + } + } + dstPath := filepath.Join(d.RecycleBinPath, obj.GetName()) if utils.Exists(dstPath) { dstPath = filepath.Join(d.RecycleBinPath, obj.GetName()+"_"+time.Now().Format("20060102150405"))