more test-fixture

This commit is contained in:
Pierre Dubouilh 2021-11-07 18:20:03 +01:00 committed by Pierre Dubouilh
parent 2f73fd9df8
commit 5440b4c5a2
5 changed files with 9 additions and 2 deletions

4
.gitignore vendored
View file

@ -40,3 +40,7 @@ test-fixture/*/*
!test-fixture/fancy-path/* !test-fixture/fancy-path/*
!test-fixture/ext/* !test-fixture/ext/*
!test-fixture/ext !test-fixture/ext
!test-fixture/.some-hidden-file
!test-fixture/hols/.hidden-folder
!test-fixture/hols/.hidden-folder/some-file
!test-fixture/compress/hols-sym

View file

@ -244,8 +244,8 @@ func checkPath(p string) string {
// panic if we had a error getting absolute path, // panic if we had a error getting absolute path,
// ... or if path doesnt contain the prefix path we expect, // ... or if path doesnt contain the prefix path we expect,
// ... or if we skipping hidden folders, and one is requested, // ... or if we're skipping hidden folders, and one is requested,
// ... or if we enable symlinks - but it resolves out of our predefined path. // ... or if we're skipping symlinks - and one resolves out of our predefined path.
if err != nil || !strings.HasPrefix(fp, initPath) || *skipHidden && strings.Contains(p, "/.") || !*symlinks && len(sl) > 0 && !strings.HasPrefix(sl, initPath) { if err != nil || !strings.HasPrefix(fp, initPath) || *skipHidden && strings.Contains(p, "/.") || !*symlinks && len(sl) > 0 && !strings.HasPrefix(sl, initPath) {
panic(errors.New("invalid path")) panic(errors.New("invalid path"))
} }

View file

@ -0,0 +1 @@
hidden !

View file

@ -0,0 +1 @@
../hols

View file

@ -0,0 +1 @@
I'm hidden by my directory!