From c1b3dc434296d04f94bd1dd28d622ba6e994e4db Mon Sep 17 00:00:00 2001 From: Tim Mulholland Date: Thu, 14 Dec 2023 22:26:03 -0800 Subject: [PATCH] Fix replica id trimming --- src/Aspire.Hosting/Dashboard/DcpDataSource.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Aspire.Hosting/Dashboard/DcpDataSource.cs b/src/Aspire.Hosting/Dashboard/DcpDataSource.cs index 835455b706..cf191ca8ed 100644 --- a/src/Aspire.Hosting/Dashboard/DcpDataSource.cs +++ b/src/Aspire.Hosting/Dashboard/DcpDataSource.cs @@ -422,11 +422,11 @@ private static string ComputeExecutableDisplayName(Executable executable) ); if (replicaSetOwner is not null && displayName.Length > 3) { - var nameParts = displayName.Split('-'); - if (nameParts.Length == 2 && nameParts[0].Length > 0 && nameParts[1].Length > 0) + var lastHyphenIndex = displayName.LastIndexOf('-'); + if (lastHyphenIndex > 0 && lastHyphenIndex < displayName.Length - 1) { // Strip the replica ID from the name. - displayName = nameParts[0]; + displayName = displayName[..lastHyphenIndex]; } } return displayName;