Browse Source

Fix convert time ip parsing in jsonv5

Shelikhoo 3 years ago
parent
commit
0468cdfa56
1 changed files with 4 additions and 1 deletions
  1. 4 1
      common/protofilter/filter.go

+ 4 - 1
common/protofilter/filter.go

@@ -55,9 +55,12 @@ func filterMessage(ctx context.Context, message protoreflect.Message) error {
 			if v2extension.ConvertTimeParseIp != "" {
 				ipValue := net.ParseIP(value.String())
 				target := message.Descriptor().Fields().ByTextName(v2extension.ConvertTimeParseIp)
+				if ipValue.To4() != nil {
+					ipValue = ipValue.To4()
+				}
 				pendingWriteQueue = append(pendingWriteQueue, pendingWrite{
 					field: target,
-					value: protoreflect.ValueOf(ipValue),
+					value: protoreflect.ValueOf([]byte(ipValue)),
 				})
 			}
 		}