mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-28 22:21:46 -05:00
resource: Use path.Match instead of filepath.Match
They behave similar, but it is a path we're matching. See #4244
This commit is contained in:
parent
20c9b6ec81
commit
4eb1650bec
1 changed files with 2 additions and 2 deletions
|
@ -360,7 +360,7 @@ func (l *genericResource) Publish() error {
|
||||||
// and matching by wildcard given in `src` using `filepath.Match` with lower cased values.
|
// and matching by wildcard given in `src` using `filepath.Match` with lower cased values.
|
||||||
// This assignment is additive, but the most specific match needs to be first.
|
// This assignment is additive, but the most specific match needs to be first.
|
||||||
// The `name` and `title` metadata field support shell-matched collection it got a match in.
|
// The `name` and `title` metadata field support shell-matched collection it got a match in.
|
||||||
// See https://golang.org/pkg/path/filepath/#Match
|
// See https://golang.org/pkg/path/#Match
|
||||||
func AssignMetadata(metadata []map[string]interface{}, resources ...Resource) error {
|
func AssignMetadata(metadata []map[string]interface{}, resources ...Resource) error {
|
||||||
|
|
||||||
counters := make(map[string]int)
|
counters := make(map[string]int)
|
||||||
|
@ -390,7 +390,7 @@ func AssignMetadata(metadata []map[string]interface{}, resources ...Resource) er
|
||||||
|
|
||||||
srcKey := strings.ToLower(cast.ToString(src))
|
srcKey := strings.ToLower(cast.ToString(src))
|
||||||
|
|
||||||
match, err := filepath.Match(srcKey, resourceSrcKey)
|
match, err := path.Match(srcKey, resourceSrcKey)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to match resource with metadata: %s", err)
|
return fmt.Errorf("failed to match resource with metadata: %s", err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue