Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

.Net: Bug: BinaryContent does not decode the %xx escapes of a non-base64 data URI

オープン 初心者向け
#14,518 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 4 日以内に返信

@Laurianti がすでに取り組んでいます。

2026年10月1日 から。

  • #14519 @Laurianti による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
76/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
csharp
領域
backend

調査の方向性

BinaryContent.GetCachedByteArrayContent から開始し、既存の DataUriParser テストを確認してください。これらのテストには、non-base64 データがそこで escaped のまま残ることが記録されています。報告された 2 つの入力について bytes への変換を検証してください。text は “A brief note” になり、binary data は FF 00 80 になり、両方のケースをカバレッジに含めます。

索引モデルが issue の本文から書いたものです。

説明

.NET triage

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

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

microsoft/semantic-kernel のほかの issue

microsoft/semantic-kernel の issue をすべて見る

似ている issue

C# の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。