@@ -40,6 +40,16 @@ func responseFlat(msg proto.Message) (map[string]interface{}, error) {
4040 prefix := path .GnmiPathToXPath (n .GetPrefix (), false )
4141 for _ , u := range n .GetUpdate () {
4242 p := path .GnmiPathToXPath (u .GetPath (), false )
43+ // If there is no prefix whatsoever, prepend
44+ // leading slash to the path
45+ if prefix == "" {
46+ p = filepath .Join ("/" , p )
47+ }
48+ // If a prefix is populated without an origin,
49+ // prepend leading slash to the prefix
50+ if n .GetPrefix ().GetOrigin () == "" && n .GetPrefix ().GetElem () != nil {
51+ prefix = filepath .Join ("/" , prefix )
52+ }
4353 vmap , err := getValueFlat (filepath .Join (prefix , p ), u .GetVal ())
4454 if err != nil {
4555 return nil , err
@@ -61,6 +71,16 @@ func responseFlat(msg proto.Message) (map[string]interface{}, error) {
6171 prefix := path .GnmiPathToXPath (n .GetPrefix (), false )
6272 for _ , u := range n .GetUpdate () {
6373 p := path .GnmiPathToXPath (u .GetPath (), false )
74+ // If there is no prefix whatsoever, prepend
75+ // leading slash to the path
76+ if prefix == "" {
77+ p = filepath .Join ("/" , p )
78+ }
79+ // If a prefix is populated without an origin,
80+ // prepend leading slash to the prefix
81+ if n .GetPrefix ().GetOrigin () == "" && n .GetPrefix ().GetElem () != nil {
82+ prefix = filepath .Join ("/" , prefix )
83+ }
6484 vmap , err := getValueFlat (filepath .Join (prefix , p ), u .GetVal ())
6585 if err != nil {
6686 return nil , err
0 commit comments