diff --git a/.gitignore b/.gitignore index 32f1de3..171e804 100755 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/gossa.go b/gossa.go index df0b5a9..7946372 100755 --- a/gossa.go +++ b/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")) } diff --git a/test-fixture/.some-hidden-file b/test-fixture/.some-hidden-file new file mode 100644 index 0000000..a72b0ea --- /dev/null +++ b/test-fixture/.some-hidden-file @@ -0,0 +1 @@ +hidden ! diff --git a/test-fixture/compress/hols-sym b/test-fixture/compress/hols-sym new file mode 120000 index 0000000..ff56861 --- /dev/null +++ b/test-fixture/compress/hols-sym @@ -0,0 +1 @@ +../hols \ No newline at end of file diff --git a/test-fixture/hols/.hidden-folder/some-file b/test-fixture/hols/.hidden-folder/some-file new file mode 100644 index 0000000..1f55d23 --- /dev/null +++ b/test-fixture/hols/.hidden-folder/some-file @@ -0,0 +1 @@ +I'm hidden by my directory!