lib/osutil: Replace IsDir with TraversesSymlink (fixes #3839)

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3883
LGTM: calmh
This commit is contained in:
Audrius Butkevicius
2017-01-10 07:09:31 +00:00
committed by Jakob Borg
parent 8d2a31e38e
commit 1a1e35d998
5 changed files with 98 additions and 70 deletions

View File

@@ -431,8 +431,8 @@ func (f *sendReceiveFolder) pullerIteration(ignores *ignore.Matcher) int {
for _, fi := range processDirectly {
// Verify that the thing we are handling lives inside a directory,
// and not a symlink or empty space.
if !osutil.IsDir(f.dir, filepath.Dir(fi.Name)) {
f.newError(fi.Name, errNotDir)
if err := osutil.TraversesSymlink(f.dir, filepath.Dir(fi.Name)); err != nil {
f.newError(fi.Name, err)
continue
}
@@ -520,8 +520,8 @@ nextFile:
// Verify that the thing we are handling lives inside a directory,
// and not a symlink or empty space.
if !osutil.IsDir(f.dir, filepath.Dir(fi.Name)) {
f.newError(fi.Name, errNotDir)
if err := osutil.TraversesSymlink(f.dir, filepath.Dir(fi.Name)); err != nil {
f.newError(fi.Name, err)
continue
}