Skip to content

Commit

Permalink
Merge pull request #70 from neuroglia-io/fix-filter-unsupported-attri…
Browse files Browse the repository at this point in the history
…butes

Fix the CloudEventRecordExtensions to filter out non-standard, unsupported cloud event attributes
  • Loading branch information
cdavernas authored Oct 8, 2024
2 parents b6c4e7a + 7c3808e commit 0eda0b6
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public static class CloudEventRecordExtensions
public static CloudEvent ToCloudEvent(this CloudEventDescriptor descriptor)
{
ArgumentNullException.ThrowIfNull(descriptor);
var e = (JsonObject)JsonSerializer.Default.SerializeToNode(descriptor.Metadata.ContextAttributes)!;
var e = (JsonObject)JsonSerializer.Default.SerializeToNode(descriptor.Metadata.ContextAttributes.Where(a => a.Key.IsLowercased() && a.Key.IsAlphanumeric()))!;
var data = JsonSerializer.Default.SerializeToNode(descriptor.Data);
e[CloudEventAttributes.Data] = data;
return JsonSerializer.Default.Deserialize<CloudEvent>(e)!;
Expand Down

0 comments on commit 0eda0b6

Please sign in to comment.