mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-16 20:53:59 +02:00
common/maps: Do not return error on params dot access on incompatible types
This error was introduced in 0.56 and has shown some site breakage in the wild. Fixes #6121
This commit is contained in:
@@ -22,10 +22,14 @@ import (
|
||||
func TestGetNestedParam(t *testing.T) {
|
||||
|
||||
m := map[string]interface{}{
|
||||
"string": "value",
|
||||
"first": 1,
|
||||
"with_underscore": 2,
|
||||
"nested": map[string]interface{}{
|
||||
"color": "blue",
|
||||
"nestednested": map[string]interface{}{
|
||||
"color": "green",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -41,5 +45,7 @@ func TestGetNestedParam(t *testing.T) {
|
||||
assert.Equal(1, must("First", "_", m))
|
||||
assert.Equal(2, must("with_underscore", "_", m))
|
||||
assert.Equal("blue", must("nested_color", "_", m))
|
||||
assert.Equal("green", must("nested.nestednested.color", ".", m))
|
||||
assert.Nil(must("string.name", ".", m))
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user