Repository navigation
.Net: Percent-decode non-base64 data URIs in BinaryContent - #14519
Open
Federico Laurianti (Laurianti) wants to merge 1 commit into
Open
Federico Laurianti (Laurianti) wants to merge 1 commit into
Federico Laurianti (Laurianti) wants to merge 1 commit into
Conversation
Federico Laurianti (Laurianti)
deployed
to
github-app-auth
October 1, 2026 11:06 — with
GitHub Actions
Active
Federico Laurianti (Laurianti)
deployed
to
github-app-auth
October 1, 2026 11:06 — with
GitHub Actions
Active
Copilot started reviewing on behalf of
Federico Laurianti (Laurianti)
October 1, 2026 11:07
View session
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The implementation matches RFC 2397 semantics and includes focused regression coverage.
Review effort: Balanced
Findings: None
What changed in this PR
Fixes non-base64 data URI conversion by decoding percent-escaped octets while preserving literal plus signs.
Changes:
- Percent-decodes non-base64 data URI payloads.
- Adds coverage for text, binary, charset, and literal-plus cases.
| File | Description |
|---|---|
dotnet/src/SemanticKernel.Abstractions/Contents/BinaryContent.cs |
Decodes escaped octets when materializing binary data. |
dotnet/src/SemanticKernel.UnitTests/Contents/BinaryContentTests.cs |
Verifies expected decoding behavior. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This branch was successfully deployed
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.
Motivation and Context
BinaryContentbuilt from a non-base64 data URI returned the URI's data as UTF-8 text with the%xxescapes still in it, while RFC 2397, whichDataUriParserfollows, defines each escape as the octet it names.ImageContentandAudioContentinherit the conversion.Fixes #14518.
Description
GetCachedByteArrayContentdecodes the escapes to bytes withWebUtility.UrlDecodeToBytes, after escaping+so that it stays a plus. Data without escapes, such as the existing01-02-03-04cases, is unchanged.ReturnPercentDecodedOctetsWhenDataIsNotBase64covers the RFC example, binary octets, aniso-8859-1octet and a literal+.Contribution Checklist