[#672] Fix handling X-Amz-Copy-Source header

Signed-off-by: Denis Kirillov <denis@nspcc.ru>
This commit is contained in:
Denis Kirillov 2022-08-24 16:12:05 +03:00 committed by Kirillov Denis
parent fdc926e70b
commit 163038b37d
7 changed files with 110 additions and 21 deletions

View file

@ -2,11 +2,17 @@ package auth
import "regexp"
type regexpSubmatcher struct {
type RegexpSubmatcher struct {
re *regexp.Regexp
}
func (r *regexpSubmatcher) getSubmatches(target string) map[string]string {
// NewRegexpMatcher creates a new regexp sub matcher.
func NewRegexpMatcher(re *regexp.Regexp) *RegexpSubmatcher {
return &RegexpSubmatcher{re: re}
}
// GetSubmatches returns matches from provided string. Zero length indicates no match.
func (r *RegexpSubmatcher) GetSubmatches(target string) map[string]string {
matches := r.re.FindStringSubmatch(target)
l := len(matches)