model: fix DotsEscaping unescape of names containing "_dot_" - #994
Open
Rohilalala wants to merge 1 commit into
Open
Rohilalala wants to merge 1 commit into
Rohilalala wants to merge 1 commit into
Conversation
UnescapeName replaced every "_dot_" before collapsing "__", so the escaped form of a name that literally contains "_dot_" was decoded wrongly: "a_dot_b" escapes to "a__dot__b" and came back as "a_._b". Decode both sequences in a single left-to-right pass with a strings.Replacer instead. Signed-off-by: Aditya <205600203+Rohilalala@users.noreply.github.com>
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.
UnescapeName(EscapeName(n, DotsEscaping), DotsEscaping)did not returnnwhenncontains the text_dot_. The firstReplaceAllmatched_dot_starting at the second underscore of an escaped__:a_dot_b→a__dot__b→a_._b(nowa_dot_b)http_dot_requests_total→http_._requests_total(now unchanged)Unescaping now decodes
__and_dot_in a single left-to-right pass with astrings.Replacer, the exact inverse ofEscapeName. Names with nothing to decode still come back without an allocation. Some inputEscapeNamecannot produce, where_dot_overlaps an underscore pair, now decodes left to right as well:a__dot_bgivesa_dot_b(it used to givea_.b).