Skip to content

Commit

Permalink
Updated for discussion #1946 and will fix #1950
Browse files Browse the repository at this point in the history
  • Loading branch information
MrHinsh committed Feb 22, 2024
1 parent 1a3311a commit 2c21827
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,22 +53,26 @@ public override void ProcessorExecutionWithFieldItem(IProcessor processor, Field
Log.LogDebug("{WorkItemProcessorEnricher}::ProcessorExecutionWithFieldItem::Disabled", this.GetType().Name);
return;
}
if (fieldItem.FieldType == "String")
if (fieldItem.FieldType == "String" && fieldItem.Value !=null)
{
foreach (var manipulator in _options.Manipulators)
{
if (manipulator.Enabled)
{
Log.LogDebug("{WorkItemProcessorEnricher}::ProcessorExecutionWithFieldItem::Running::{Description}", this.GetType().Name, manipulator.Description);
Log.LogDebug("{WorkItemProcessorEnricher}::ProcessorExecutionWithFieldItem::Running::{Description} with {pattern}", this.GetType().Name, manipulator.Description, manipulator.Pattern);
fieldItem.Value = Regex.Replace((string)fieldItem.Value, manipulator.Pattern, manipulator.Replacement);
if (fieldItem.Value.ToString().Length > 0 && fieldItem.Value.ToString().Length > _options.MaxStringLength)
{
fieldItem.Value = fieldItem.Value.ToString().Substring(0, Math.Min(fieldItem.Value.ToString().Length, _options.MaxStringLength));
}
}
else
{
Log.LogDebug("{WorkItemProcessorEnricher}::ProcessorExecutionWithFieldItem::Disabled::{Description}", this.GetType().Name, manipulator.Description);
}
}
}
fieldItem.Value.ToString().Substring(0, Math.Min(fieldItem.Value.ToString().Length-1, _options.MaxStringLength-1));

}
}

Expand Down

0 comments on commit 2c21827

Please sign in to comment.