api: paths that are not valid UTF-8 come back changed in JSON

Đang mở
#587 3 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@ThomasK33 đang làm issue này rồi.

Từ ngày 6/11/2026.

  • #729 của @ThomasK33 — đang mở

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
25/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
go, json
Lĩnh vực
api, backend-api-design

Hướng nghiên cứu

The issue identifies Go's encoding/json behavior and says every endpoint that returns paths is affected, but it names no files or tests. Start by locating the API path fields and their JSON serialization, then review the open linked pull request #729 and its discussion. Done means agreeing on a wire format for non-UTF-8 paths, documenting it, and ensuring clients can round-trip the original path bytes.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Problem

A tree entry name may hold bytes that are not valid UTF-8 (git accepts any byte except NUL and /). The API returns such a path changed: Go's encoding/json writes each invalid byte as U+FFFD, so a<0xff>b comes back as "a\ufffdb". A client cannot send that path back (for example in grep paths, file?path=, blame?path=), because it no longer names the file. This affects every endpoint that returns paths. Main has the same behavior.

The grep cursor is not affected: it base64-encodes the raw path bytes, so paging still works.

Found

By the clean-context advisor on PR #585 (#583, newline paths in grep), 2026-10-28. The advisor checked the encoding/json behavior. I did not call the API with such a path.

Possible fix

Decide on a wire form for non-UTF-8 paths (for example, an extra base64 field next to path, as some git hosting APIs do), and document it. This is an API design decision.

Trigger

A user report of a path that cannot be read back, or the next API change that adds a path field.


Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high

Ngôn ngữ chính
Go
Star
0
Fork
0
Merge trung bình
6 giờ 16 phút
Pull request đã merge (30 ngày)
243

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của coder/openstorage

Tất cả issue của coder/openstorage

Issue tương tự

Thêm issue về Go

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.