globToRegexp converts a path glob, where `*` matches any sequence of characters including `/`, into an anchored extended regular expression
(pattern string)
| 668 | // globToRegexp converts a path glob, where `*` matches any sequence of |
| 669 | // characters including `/`, into an anchored extended regular expression |
| 670 | func globToRegexp(pattern string) string { |
| 671 | fragments := strings.Split(pattern, "*") |
| 672 | for i, fragment := range fragments { |
| 673 | fragments[i] = regexp.QuoteMeta(fragment) |
| 674 | } |
| 675 | return "^" + strings.Join(fragments, ".*") + "$" |
| 676 | } |
| 677 | |
| 678 | // listFilesScript builds a shell script printing every object in the store |
| 679 | // as a `bucket/key` line, filtered by the glob expressed in the given path. |