in src/Google.Cloud.Functions.Framework/GcfEvents/GcfConverters.cs [389:407]
protected override void PopulateAttributes(Request request, CloudEvent evt)
{
string resource = request.Context.Resource.Name!;
string service = request.Context.Resource.Service!;
string[] resourceSegments = resource.Split('/', SubjectStartIndex + 1);
if (resourceSegments.Length < SubjectStartIndex ||
!resourceSegments[SubjectStartIndex].StartsWith(ExpectedSubjectPrefix, StringComparison.Ordinal))
{
// This is odd... just put everything in the source as normal.
base.PopulateAttributes(request, evt);
}
else
{
string sourcePath = string.Join('/', resourceSegments.Take(SubjectStartIndex));
evt.Source = FormatSource(service, sourcePath);
evt.Subject = resourceSegments[SubjectStartIndex];
}
}