Skip to content

Commit

Permalink
[Preview] Truncate LongText fields to 1m (#1903)
Browse files Browse the repository at this point in the history
This should truncate longTest fields to the max length and resolve #1861
  • Loading branch information
MrHinsh authored Feb 5, 2024
1 parent cb654f0 commit ce11b18
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Microsoft.TeamFoundation.Common;
using Microsoft.TeamFoundation.TestManagement;
using Microsoft.TeamFoundation.WorkItemTracking.Client;
using Microsoft.TeamFoundation.WorkItemTracking.Proxy;
using Microsoft.TeamFoundation.WorkItemTracking.WebApi;
Expand Down Expand Up @@ -511,10 +512,14 @@ private void PopulateWorkItem(WorkItemData oldWi, WorkItemData newwit, string de
Log.LogDebug("PopulateWorkItem:FieldUpdate: {ReferenceName} | Source:{OldReferenceValue} Target:{NewReferenceValue}", f.ReferenceName, oldWorkItem.Fields[f.ReferenceName].Value, newWorkItem.Fields[f.ReferenceName].Value);

newWorkItem.Fields[f.ReferenceName].Value = oldWorkItem.Fields[f.ReferenceName].Value;
} else
{

}
if (newWorkItem.Fields[f.ReferenceName].FieldDefinition.IsLongText)
{
// Truncate field to max length
newWorkItem.Fields[f.ReferenceName].Value = newWorkItem.Fields[f.ReferenceName].Value.ToString().Substring(0, 1000000);
}

}
}

if (_nodeStructureEnricher.Options.Enabled)
Expand Down

0 comments on commit ce11b18

Please sign in to comment.