Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support follow symlinks on directories #52

Open
milahu opened this issue Oct 1, 2020 · 1 comment
Open

support follow symlinks on directories #52

milahu opened this issue Oct 1, 2020 · 1 comment
Labels
enhancement New feature or request

Comments

@milahu
Copy link

milahu commented Oct 1, 2020

currently tiny-glob does not find files in symlinked directories

sample:

#!/bin/bash

mkdir dir-1
touch dir-1/file-1
ln -s dir-1 dir-1-linked

# run tiny-glob
node -e "console.log(require('tiny-glob/sync.js')('dir*/**').join('\n'))"

# actual result
dir-1/file-1

# expected result
dir-1/file-1
dir-1-linked/file-1

the problem should be

if (!stats.isDirectory()) {

which does not detect symlinked directories
where stats.isSymbolicLink() == true

fs.realpathSync(path) can be used to fully resolve the link target
but that returns the absolute path ....

other glob tools have this feature normally off
and only enabled with a follow: true option
one reason: circular symlinks give infinite recursion

@terkelg
Copy link
Owner

terkelg commented Oct 26, 2020

Thank you! Would you mind doing a PR for this?

@terkelg terkelg added the enhancement New feature or request label Oct 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants