Repository navigation
Fixed log ip sanitizer - #15
Merged
Merged
Conversation
vtm9
requested changes
Oct 16, 2026
vtm9
left a comment
Contributor
There was a problem hiding this comment.
Allowing arbitrary leading zeros is a valid fix, but the new regex consumes invalid four-octet candidates and then skips valid addresses beginning inside them.
Reproduction: solution("999.1.2.3.4") currently returns "999.[REDACTED]"; this PR returns "999.1.2.3.4". The address 1.2.3.4 is valid and bounded by a dot and the string end, as the description permits. "256.001.002.003.004" has the same regression.
Please preserve scanning for valid addresses after a rejected candidate, while keeping leading-zero support, and add both regression cases. All 30 existing asserts pass, so additional coverage is needed.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Раз уж по условию разрешены ведущие нули, то исправил тест, в котором из-за такого же ведущего нуля IP-адрес почему-то не признавался, а также исправил эталонное решение.