blob: 493dfe39952c09547adeb4404905d54a1d20587b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
package app
import (
"path/filepath"
"strings"
)
func deepContainsH(basepath, targpath string) (bool, error) {
const upper = ".." + string(filepath.Separator)
rel, err := filepath.Rel(basepath, targpath)
return err == nil &&
rel != ".." &&
!strings.HasPrefix(rel, upper), err
}
|