.Net: Bug: BinaryContent does not decode the %xx escapes of a non-base64 data URI
Maintainer thường phản hồi trong vòng 4 ngày
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 76/100
Hướng nghiên cứu
Bắt đầu tại BinaryContent.GetCachedByteArrayContent và xem lại các bài kiểm thử DataUriParser hiện có, trong đó ghi nhận rằng dữ liệu không phải base64 vẫn được escape tại đó. Xác minh việc chuyển đổi sang bytes đối với hai đầu vào được báo cáo: văn bản trở thành “A brief note” và dữ liệu nhị phân trở thành FF 00 80, với phạm vi bao phủ cho cả hai trường hợp.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- C#
- Star
- 28.6k
- Fork
- 4.8k
- Merge trung bình
- 1 ngày 18 giờ
- Pull request đã merge (30 ngày)
- 19
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của microsoft/semantic-kernel
-
.Net: gpt-image-1 is the default image model in the .NET OpenAI connector, and OpenAI shuts it down on October 23Có thể đã có người làm @nightcityblade đã nhận 3 ngày trước. Đang mở.NET triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 73/100
microsoft/semantic-kernel#14526 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 4 ngày
-
Python: VolatileMemoryStore.get_batch and get_nearest_matches ignore with_embeddings=False (deepcopy result is discarded)Có thể đã có người làm @VANDRANKI đã nhận 5 ngày trước. Đang mởpython triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
microsoft/semantic-kernel#14522 ·
Maintainer thường phản hồi trong vòng 4 ngày
-
Python: VolatileMemoryStore.get_nearest_match returns an un-awaited coroutine instead of a (MemoryRecord, score) tupleCó thể đã có người làm @VANDRANKI đã nhận 5 ngày trước. Đang mởpython triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
microsoft/semantic-kernel#14521 ·
Maintainer thường phản hồi trong vòng 4 ngày
-
Python: FunctionCallContent.combine_arguments drops a streamed "{}" chunk, producing invalid JSON argumentsCó thể đã có người làm @VANDRANKI đã nhận 6 ngày trước. Đang mởpython triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
microsoft/semantic-kernel#14512 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 4 ngày
-
.Net: Python: KernelJsonSchemaBuilder emits {"type": "object"} with no enum for typing.Literal parameters and fieldsCó thể đã có người làm @VANDRANKI đã nhận 6 ngày trước. Đang mở.NET python triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
microsoft/semantic-kernel#14511 ·
Maintainer thường phản hồi trong vòng 4 ngày
Tất cả issue của microsoft/semantic-kernel
Issue tương tự
-
S: Untriaged
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
space-wizards/space-station-14#46357 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Versioning_oM: Remove unneeded depeendecy on Test_oMCó thể đã có người làm @IsakNaslundBh đã nhận hôm nay. Đang mởtype:bug type:compliance
Độ khó 2/5 Dưới một giờ Mức phù hợp với người mới 85/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
MicrosoftLearning/PL-400_Microsoft-Power-Platform-Developer#231 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
joinrpg/joinrpg-net#5313 ·
Maintainer thường phản hồi trong vòng 1 ngày