Skip to content

Commit d16d282

Browse files
Copilotstephentoub
andauthored
Simplify scope split loops: remove unnecessary empty-entry checks
Agent-Logs-Url: https://github.com/modelcontextprotocol/csharp-sdk/sessions/bb2f14d3-4d60-438a-a84a-6f3b5c36cb8c Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
1 parent afc57dd commit d16d282

1 file changed

Lines changed: 5 additions & 8 deletions

File tree

src/ModelContextProtocol.Core/Authentication/ClientOAuthProvider.cs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -737,20 +737,17 @@ private async Task PerformDynamicClientRegistrationAsync(
737737
if (_lastRequestedScopes is not null && newScopes is not null)
738738
{
739739
var combined = new HashSet<string>(StringComparer.Ordinal);
740+
740741
foreach (var scope in _lastRequestedScopes.Split(' '))
741742
{
742-
if (scope.Length > 0)
743-
{
744-
combined.Add(scope);
745-
}
743+
combined.Add(scope);
746744
}
745+
747746
foreach (var scope in newScopes.Split(' '))
748747
{
749-
if (scope.Length > 0)
750-
{
751-
combined.Add(scope);
752-
}
748+
combined.Add(scope);
753749
}
750+
754751
newScopes = string.Join(" ", combined);
755752
}
756753

0 commit comments

Comments
 (0)