mirror of
https://github.com/niusmallnan/steve.git
synced 2025-09-03 06:05:41 +00:00
Convert to string to fix nil value
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"fmt"
|
||||
|
||||
"github.com/rancher/norman/pkg/types"
|
||||
"github.com/rancher/norman/pkg/types/convert"
|
||||
"github.com/rancher/norman/pkg/types/values"
|
||||
)
|
||||
|
||||
@@ -20,8 +21,8 @@ func (d *defaultMapper) FromInternal(data map[string]interface{}) {
|
||||
return
|
||||
}
|
||||
|
||||
name := values.GetValueN(data, "metadata", "name")
|
||||
namespace := values.GetValueN(data, "metadata", "namespace")
|
||||
name := convert.ToString(values.GetValueN(data, "metadata", "name"))
|
||||
namespace := convert.ToString(values.GetValueN(data, "metadata", "namespace"))
|
||||
|
||||
if namespace == "" {
|
||||
data["id"] = name
|
||||
|
Reference in New Issue
Block a user