otiai10 / copy

Go copy directory recursively

Home Page:https://pkg.go.dev/github.com/otiai10/copy

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Deep symlink copy doesn't work with relative `../foo` target

samuel-phan opened this issue · comments

Deep symlink copy will fail in this situation:

test
├── data
│   ├── case00
│   │   └── README.md
│   ├── case01
│   │   └── README.md
│   ├── case02
│   │   └── README.md
│   ├── case03
│   │   ├── README.md
│   │   ├── case01 -> test/data/case01
│   │   └── relative_case01 -> ../case01

Though it's entirely acceptable to have a symlink working only at a certain current working dir, most of the time, we have symlinks:

  • either to an absolute path
  • or relative to itself (eg ../something). 🐛 This case doesn't work properly.
Screenshot 2023-11-13 at 9 51 28 PM

changing from os.Readlink to filepath.EvalSymlinks worked in my local.