fix(tsconnect): lowercase name/size in waitingFiles JSON

apitype.WaitingFile has no json tags so it serialised as {Name, Size}.
Introduce a local jsWaitingFile struct with json:"name" / json:"size"
so the JS side receives idiomatic camelCase property names.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit was merged in pull request #2.
This commit is contained in:
2026-04-17 19:39:52 +00:00
parent e32520659d
commit 8277fc0f1d
+8 -3
View File
@@ -166,10 +166,15 @@ func (i *jsIPN) waitingFiles() js.Value {
if err != nil {
return nil, err
}
if wfs == nil {
wfs = []apitype.WaitingFile{}
type jsWaitingFile struct {
Name string `json:"name"`
Size int64 `json:"size"`
}
b, err := json.Marshal(wfs)
out := make([]jsWaitingFile, len(wfs))
for i, wf := range wfs {
out[i] = jsWaitingFile{Name: wf.Name, Size: wf.Size}
}
b, err := json.Marshal(out)
if err != nil {
return nil, err
}