.Net: Bug: BinaryContent does not decode the %xx escapes of a non-base64 data URI
メンテナーはふだん 4 日以内に返信
評価
調査の方向性
BinaryContent.GetCachedByteArrayContent から開始し、既存の DataUriParser テストを確認してください。これらのテストには、non-base64 データがそこで escaped のまま残ることが記録されています。報告された 2 つの入力について bytes への変換を検証してください。text は “A brief note” になり、binary data は FF 00 80 になり、両方のケースをカバレッジに含めます。
索引モデルが issue の本文から書いたものです。
説明
Describe the bug
BinaryContent, and so ImageContent and AudioContent, built from a data URI without ;base64 returns the URI's data as UTF-8 text with the %xx escapes still in it. DataUriParser follows RFC 2397, where "the data (as a sequence of octets) is represented using ASCII encoding for octets inside the range of safe URL characters and using the standard %xx hex encoding of URLs for octets outside that range".
To Reproduce
var content = new BinaryContent("data:,A%20brief%20note");
Console.WriteLine(Encoding.UTF8.GetString(content.Data!.Value.Span)); // A%20brief%20note
Data as hex:
data:,A%20brief%20note -> 41 25 32 30 62 72 69 65 66 25 32 30 6E 6F 74 65 ("A%20brief%20note")
data:application/octet-stream,%FF%00%80 -> 25 46 46 25 30 30 25 38 30 ("%FF%00%80")
Expected behavior
A brief note, as in the RFC 2397 example ("The URL data:,A%20brief%20note encodes the text/plain string "A brief note""), and the three octets FF 00 80.
Platform
- Language: C#
- Source: NuGet Microsoft.SemanticKernel.Abstractions 1.80.1, also main at 58ad1a378
- OS: Linux (mcr.microsoft.com/dotnet/sdk:10.0)
Additional context
BinaryContent.GetCachedByteArrayContent returns Encoding.UTF8.GetBytes(parsedDataUri.Data) for non-base64 data. DataUriParser keeps the data escaped (its tests expect A%20brief%20note), so the decoding belongs to the conversion to bytes.
- 主要言語
- C#
- スター
- 28.6k
- フォーク
- 4.8k
- 平均マージ
- 1日 18時間
- マージ済み PR(30日)
- 19
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
microsoft/semantic-kernel のほかの issue
-
.Net: gpt-image-1 is the default image model in the .NET OpenAI connector, and OpenAI shuts it down on October 23対応中かも @nightcityblade が 3 日前に担当しました。 オープン.NET triage
難易度 2/5 1〜3時間 初心者へのやさしさ 73/100
microsoft/semantic-kernel#14526 · コメント 1 件 ·
メンテナーはふだん 4 日以内に返信
-
Python: VolatileMemoryStore.get_batch and get_nearest_matches ignore with_embeddings=False (deepcopy result is discarded)対応中かも @VANDRANKI が 5 日前に担当しました。 オープンpython triage
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
microsoft/semantic-kernel#14522 ·
メンテナーはふだん 4 日以内に返信
-
Python: VolatileMemoryStore.get_nearest_match returns an un-awaited coroutine instead of a (MemoryRecord, score) tuple対応中かも @VANDRANKI が 5 日前に担当しました。 オープンpython triage
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
microsoft/semantic-kernel#14521 ·
メンテナーはふだん 4 日以内に返信
-
Python: FunctionCallContent.combine_arguments drops a streamed "{}" chunk, producing invalid JSON arguments対応中かも @VANDRANKI が 6 日前に担当しました。 オープンpython triage
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
microsoft/semantic-kernel#14512 · コメント 2 件 ·
メンテナーはふだん 4 日以内に返信
-
.Net: Python: KernelJsonSchemaBuilder emits {"type": "object"} with no enum for typing.Literal parameters and fields対応中かも @VANDRANKI が 6 日前に担当しました。 オープン.NET python triage
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
microsoft/semantic-kernel#14511 ·
メンテナーはふだん 4 日以内に返信
microsoft/semantic-kernel の issue をすべて見る
似ている issue
-
Проблема с Dotnet RUオープンarea-tutorials needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
dotnet/website-feedback#1779 ·
-
conductor good first issue ready
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
nilvon9wo/agentic-software-workflow#25 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
S: Untriaged
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
space-wizards/space-station-14#46357 ·
メンテナーはふだん 1 日以内に返信
-
Versioning_oM: Remove unneeded depeendecy on Test_oM対応中かも @IsakNaslundBh が今日担当しました。 オープンtype:bug type:compliance
難易度 2/5 1時間未満 初心者へのやさしさ 85/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100