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

Aperta
#587 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@ThomasK33 ci sta già lavorando.

Dal 6/11/2026.

  • #729 di @ThomasK33 — aperta

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
25/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
go, json

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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

Lingua principale
Go
Stelle
0
Fork
0
Merge medio
6h 16m
PR unite (30g)
243

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di coder/openstorage

Tutte le issue di coder/openstorage

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.