Unverified Commit 0eb278ea authored by listencx's avatar listencx Committed by GitHub
Browse files

fix: if obj.GetPath not found use obj.Get (#297)

parent f720d8c1
Showing with 12 additions and 6 deletions
+12 -6
......@@ -77,14 +77,20 @@ func (r *MoveProcessor) Process(e api.Event) error {
e.Fill(e.Meta(), e.Header(), []byte{})
continue
}
val := obj.GetPath(from)
if val.IsNull() {
log.Info("move fields from %s is not exist", from)
log.Debug("move event: %s", e.String())
pathVal := obj.GetPath(from)
if !pathVal.IsNull() {
obj.DelPath(from)
obj.SetPath(convert.To, pathVal.Value())
continue
}
obj.DelPath(from)
obj.SetPath(convert.To, val.Value())
val := obj.Get(from)
if !val.IsNull() {
obj.Del(from)
obj.Set(convert.To, val.Value())
continue
}
log.Info("move fields from %s is not exist", from)
log.Debug("move event: %s", e.String())
}
return nil
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment