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

Offen
#587 3 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

@ThomasK33 arbeitet bereits daran.

Seit 06.11.2026.

  • #729 von @ThomasK33 — offen

Bewertung

Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Anfängerfreundlichkeit
25/100
Issue-Typ
Feature
Klarheit
Größtenteils klar
Aktivitätsstatus
Veraltet
Tech-Stack
go, json

Rechercherichtung

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.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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

Vorherrschende Sprache
Go
Sterne
0
Forks
0
Ø Merge
6 Std. 16 Min.
Gemergte PRs (30 T.)
243

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus coder/openstorage

Alle Issues in coder/openstorage

Ähnliche Issues

Weitere Issues zu Go

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.