mirror of
https://github.com/pldubouilh/gossa
synced 2025-12-06 00:12:36 +01:00
more test-fixture
This commit is contained in:
parent
2f73fd9df8
commit
5440b4c5a2
5 changed files with 9 additions and 2 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
|
@ -40,3 +40,7 @@ test-fixture/*/*
|
|||
!test-fixture/fancy-path/*
|
||||
!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
|
||||
|
|
|
|||
4
gossa.go
4
gossa.go
|
|
@ -244,8 +244,8 @@ func checkPath(p string) string {
|
|||
|
||||
// panic if we had a error getting absolute path,
|
||||
// ... or if path doesnt contain the prefix path we expect,
|
||||
// ... or if we 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 hidden folders, and one is requested,
|
||||
// ... 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) {
|
||||
panic(errors.New("invalid path"))
|
||||
}
|
||||
|
|
|
|||
1
test-fixture/.some-hidden-file
Normal file
1
test-fixture/.some-hidden-file
Normal file
|
|
@ -0,0 +1 @@
|
|||
hidden !
|
||||
1
test-fixture/compress/hols-sym
Symbolic link
1
test-fixture/compress/hols-sym
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
../hols
|
||||
1
test-fixture/hols/.hidden-folder/some-file
Normal file
1
test-fixture/hols/.hidden-folder/some-file
Normal file
|
|
@ -0,0 +1 @@
|
|||
I'm hidden by my directory!
|
||||
Loading…
Reference in a new issue