File tree Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -375,18 +375,26 @@ func (d *Local) Remove(ctx context.Context, obj model.Obj) error {
375375 err = os .Remove (obj .GetPath ())
376376 }
377377 } else {
378- if ! utils .Exists (d .RecycleBinPath ) {
379- err = os .MkdirAll (d .RecycleBinPath , 0o755 )
378+ objPath := obj .GetPath ()
379+ objName := obj .GetName ()
380+ var relPath string
381+ relPath , err = filepath .Rel (d .GetRootPath (), filepath .Dir (objPath ))
382+ if err != nil {
383+ return err
384+ }
385+ recycleBinPath := filepath .Join (d .RecycleBinPath , relPath )
386+ if ! utils .Exists (recycleBinPath ) {
387+ err = os .MkdirAll (recycleBinPath , 0o755 )
380388 if err != nil {
381389 return err
382390 }
383391 }
384392
385- dstPath := filepath .Join (d . RecycleBinPath , obj . GetName () )
393+ dstPath := filepath .Join (recycleBinPath , objName )
386394 if utils .Exists (dstPath ) {
387- dstPath = filepath .Join (d . RecycleBinPath , obj . GetName () + "_" + time .Now ().Format ("20060102150405" ))
395+ dstPath = filepath .Join (recycleBinPath , objName + "_" + time .Now ().Format ("20060102150405" ))
388396 }
389- err = os .Rename (obj . GetPath () , dstPath )
397+ err = os .Rename (objPath , dstPath )
390398 }
391399 if err != nil {
392400 return err
You can’t perform that action at this time.
0 commit comments