diff --git a/go.mod b/go.mod index e865c77a8..ff733f97b 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/stashapp/stash require ( github.com/99designs/gqlgen v0.9.0 github.com/PuerkitoBio/goquery v1.5.0 - github.com/bmatcuk/doublestar v1.1.1 + github.com/bmatcuk/doublestar v1.1.5 github.com/disintegration/imaging v1.6.0 github.com/fsnotify/fsnotify v1.4.7 github.com/go-chi/chi v4.0.2+incompatible diff --git a/go.sum b/go.sum index f24b92937..ddb5a70ee 100644 --- a/go.sum +++ b/go.sum @@ -47,6 +47,8 @@ github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+Ce github.com/bitly/go-hostpool v0.0.0-20171023180738-a3a6125de932/go.mod h1:NOuUCSz6Q9T7+igc/hlvDOUdtWKryOrtFyIVABv/p7k= github.com/bmatcuk/doublestar v1.1.1 h1:YroD6BJCZBYx06yYFEWvUuKVWQn3vLLQAVmDmvTSaiQ= github.com/bmatcuk/doublestar v1.1.1/go.mod h1:UD6OnuiIn0yFxxA2le/rnRU1G4RaI4UvFv1sNto9p6w= +github.com/bmatcuk/doublestar v1.1.5 h1:2bNwBOmhyFEFcoB3tGvTD5xanq+4kyOZlB8wFYbMjkk= +github.com/bmatcuk/doublestar v1.1.5/go.mod h1:wiQtGV+rzVYxB7WIlirSN++5HPtPlXEo9MEoZQC/PmE= github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4= github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBTaaSFSlLx/70C2HPIMNZpVV8+vt/A+FMnYP11g= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= diff --git a/vendor/github.com/bmatcuk/doublestar/.gitignore b/vendor/github.com/bmatcuk/doublestar/.gitignore index 76d92ba4b..af212ecc2 100644 --- a/vendor/github.com/bmatcuk/doublestar/.gitignore +++ b/vendor/github.com/bmatcuk/doublestar/.gitignore @@ -27,3 +27,6 @@ _testmain.go *.exe *.test *.prof + +# test directory +test/ diff --git a/vendor/github.com/bmatcuk/doublestar/.travis.yml b/vendor/github.com/bmatcuk/doublestar/.travis.yml index cf3c884ad..ec4fee889 100644 --- a/vendor/github.com/bmatcuk/doublestar/.travis.yml +++ b/vendor/github.com/bmatcuk/doublestar/.travis.yml @@ -1,10 +1,8 @@ language: go go: - - 1.3 - - 1.4 - - 1.5 - - 1.6 + - 1.11 + - 1.12 before_install: - go get -t -v ./... diff --git a/vendor/github.com/bmatcuk/doublestar/doublestar.go b/vendor/github.com/bmatcuk/doublestar/doublestar.go index ceab4e35b..0044dfa83 100644 --- a/vendor/github.com/bmatcuk/doublestar/doublestar.go +++ b/vendor/github.com/bmatcuk/doublestar/doublestar.go @@ -9,35 +9,49 @@ import ( "unicode/utf8" ) +// ErrBadPattern indicates a pattern was malformed. var ErrBadPattern = path.ErrBadPattern // Split a path on the given separator, respecting escaping. -func splitPathOnSeparator(path string, separator rune) []string { - // if the separator is '\\', then we can just split... +func splitPathOnSeparator(path string, separator rune) (ret []string) { + idx := 0 if separator == '\\' { - return strings.Split(path, string(separator)) + // if the separator is '\\', then we can just split... + ret = strings.Split(path, string(separator)) + idx = len(ret) + } else { + // otherwise, we need to be careful of situations where the separator was escaped + cnt := strings.Count(path, string(separator)) + if cnt == 0 { + return []string{path} + } + + ret = make([]string, cnt+1) + pathlen := len(path) + separatorLen := utf8.RuneLen(separator) + emptyEnd := false + for start := 0; start < pathlen; { + end := indexRuneWithEscaping(path[start:], separator) + if end == -1 { + emptyEnd = false + end = pathlen + } else { + emptyEnd = true + end += start + } + ret[idx] = path[start:end] + start = end + separatorLen + idx++ + } + + // If the last rune is a path separator, we need to append an empty string to + // represent the last, empty path component. By default, the strings from + // make([]string, ...) will be empty, so we just need to icrement the count + if emptyEnd { + idx++ + } } - // otherwise, we need to be careful of situations where the separator was escaped - cnt := strings.Count(path, string(separator)) - if cnt == 0 { - return []string{path} - } - ret := make([]string, cnt+1) - pathlen := len(path) - separatorLen := utf8.RuneLen(separator) - idx := 0 - for start := 0; start < pathlen; { - end := indexRuneWithEscaping(path[start:], separator) - if end == -1 { - end = pathlen - } else { - end += start - } - ret[idx] = path[start:end] - start = end + separatorLen - idx++ - } return ret[:idx] } @@ -65,8 +79,8 @@ func indexRuneWithEscaping(s string, r rune) int { // { term } // term: // '*' matches any sequence of non-path-separators -// '**' matches any sequence of characters, including -// path separators. +// '**' matches any sequence of characters, including +// path separators. // '?' matches any single non-path-separator character // '[' [ '^' ] { character-range } ']' // character class (must be non-empty) @@ -160,13 +174,14 @@ func doMatching(patternComponents, nameComponents []string) (matched bool, err e } } return false, nil - } else { - // try matching components - matched, err = matchComponent(patternComponents[patIdx], nameComponents[nameIdx]) - if !matched || err != nil { - return - } } + + // try matching components + matched, err = matchComponent(patternComponents[patIdx], nameComponents[nameIdx]) + if !matched || err != nil { + return + } + patIdx++ nameIdx++ } @@ -194,14 +209,20 @@ func Glob(pattern string) (matches []string, err error) { return nil, nil } - // On Windows systems, this will return the drive name ('C:'), on others, - // it will return an empty string. + // On Windows systems, this will return the drive name ('C:') for filesystem + // paths, or \\\ for UNC paths. On other systems, it will + // return an empty string. Since absolute paths on non-Windows systems start + // with a slash, patternComponent[0] == volumeName will return true for both + // absolute Windows paths and absolute non-Windows paths, but we need a + // separate check for UNC paths. volumeName := filepath.VolumeName(pattern) - - // If the first pattern component is equal to the volume name, then the - // pattern is an absolute path. - if patternComponents[0] == volumeName { - return doGlob(fmt.Sprintf("%s%s", volumeName, string(os.PathSeparator)), patternComponents[1:], matches) + isWindowsUNC := strings.HasPrefix(pattern, `\\`) + if isWindowsUNC || patternComponents[0] == volumeName { + startComponentIndex := 1 + if isWindowsUNC { + startComponentIndex = 4 + } + return doGlob(fmt.Sprintf("%s%s", volumeName, string(os.PathSeparator)), patternComponents[startComponentIndex:], matches) } // otherwise, it's a relative pattern diff --git a/vendor/github.com/bmatcuk/doublestar/go.mod b/vendor/github.com/bmatcuk/doublestar/go.mod index 1d0378b15..ce1688f73 100644 --- a/vendor/github.com/bmatcuk/doublestar/go.mod +++ b/vendor/github.com/bmatcuk/doublestar/go.mod @@ -1 +1,3 @@ module github.com/bmatcuk/doublestar + +go 1.12 diff --git a/vendor/modules.txt b/vendor/modules.txt index baac2df3e..ca3ec59b7 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -11,7 +11,7 @@ github.com/PuerkitoBio/goquery github.com/agnivade/levenshtein # github.com/andybalholm/cascadia v1.0.0 github.com/andybalholm/cascadia -# github.com/bmatcuk/doublestar v1.1.1 +# github.com/bmatcuk/doublestar v1.1.5 github.com/bmatcuk/doublestar # github.com/disintegration/imaging v1.6.0 github.com/disintegration/imaging