fix: handle literal % in Readme descriptions during deserialization#2593
Open
kabhishek1001 wants to merge 1 commit into
Open
fix: handle literal % in Readme descriptions during deserialization#2593kabhishek1001 wants to merge 1 commit into
kabhishek1001 wants to merge 1 commit into
Conversation
URLDecoder.decode() throws IllegalArgumentException when a string contains % not followed by two valid hex digits. Readme descriptions stored as plain text (e.g. "50% faster") hit this when the AssetDeserializer calls decodeContent() during an index search response. Fall back to returning the original string when decoding fails, so a malformed or plain-text description doesn't crash deserialization of the entire batch.
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.
What
URLDecoder.decode()throwsIllegalArgumentExceptionwhen it encounters a%not followed by exactly two valid hex digits.AssetDeserializercallsStringUtils.decodeContent()on the description of everyReadmeasset during index search response deserialization. If any Readme in the result batch has plain text like"50% faster"in its description, the exception propagates through Jackson and crashes deserialization of the entire batch — not just the offending asset.Fix
Catch
IllegalArgumentExceptionindecodeContent()and return the original string. Legitimately URL-encoded descriptions (the normal case) continue to decode correctly. Plain-text descriptions that happen to contain%are returned as-is, which is the right behavior, as they were never URL-encoded in the first place.Testing
Added
decodeContentWithLiteralPercent()toStringUtilsTestcovering the two patterns seen in production (%;and% u) plus the null case. ExistingencodeDecodeContent()test confirms the happy path is unaffected.