You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix: prevent IndexOutOfRangeException in StringExtensions.ToSnakeCase - #8389
Thanks for opening this pull request! Please add a changelog entry under ## [Unreleased] in CHANGELOG.md, before the first released version section, so users can see what changed. Add bug fixes under ### Changed and new features under ### Added.
The new cases do not exercise the span[..counter] fix: with the default separator, each of these inputs fills the allocated span exactly, so reverting that fix would still pass. Add a custom-separator case such as "a.B".ToSnakeCase('.'), where separator counting allocates four chars but only three are written, to prevent trailing-null regressions.
The reason will be displayed to describe this comment to others. Learn more.
🟢 Approval recommended
The targeted fixes address the reported failures with regression coverage and no unresolved findings.
No open issues 🎉
Review effort: Balanced
This branch has not been deployed
No deployments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes IndexOutOfRangeException in StringExtensions.ToSnakeCase under multiple edge cases:
ameSpan[i + 1] when the input string ends with a hyphen.
ameSpan[0].
ew string(span[..counter]) to avoid returning uninitialized or null characters if fewer characters are written than allocated.
Validation
dotnet test tests/Kiota.Builder.Tests/Kiota.Builder.Tests.csproj --no-restore --nologo --filter 'FullyQualifiedName!~KiotaSearcherTests' --verbosity quiet (2,899 passed, 2 skipped)
dotnet test tests/Kiota.Tests/Kiota.Tests.csproj (18 passed)
Fixes #8388