mirror of
https://github.com/octoleo/syncthing.git
synced 2025-02-04 04:48:28 +00:00
This was broken in the Protobuf refactor. The reason is that with the previous library, generated types would have a JSON marshalling method that would automatically return strings for enums. In the current library you need to use the jsonpb marshaller for that, but these are hand crafted structs so we can't do that. The easy solution is to just use strings directly, since this is an API-only type anyway.
This commit is contained in:
parent
dcd280e6e2
commit
74ffb85467
@ -2735,7 +2735,7 @@ type TreeEntry struct {
|
|||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
ModTime time.Time `json:"modTime"`
|
ModTime time.Time `json:"modTime"`
|
||||||
Size int64 `json:"size"`
|
Size int64 `json:"size"`
|
||||||
Type protocol.FileInfoType `json:"type"`
|
Type string `json:"type"`
|
||||||
Children []*TreeEntry `json:"children,omitempty"`
|
Children []*TreeEntry `json:"children,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2804,7 +2804,7 @@ func (m *model) GlobalDirectoryTree(folder, prefix string, levels int, dirsOnly
|
|||||||
|
|
||||||
parent.Children = append(parent.Children, &TreeEntry{
|
parent.Children = append(parent.Children, &TreeEntry{
|
||||||
Name: base,
|
Name: base,
|
||||||
Type: f.Type,
|
Type: f.Type.String(),
|
||||||
ModTime: f.ModTime(),
|
ModTime: f.ModTime(),
|
||||||
Size: f.FileSize(),
|
Size: f.FileSize(),
|
||||||
})
|
})
|
||||||
|
@ -1729,7 +1729,7 @@ func TestGlobalDirectoryTree(t *testing.T) {
|
|||||||
Name: name,
|
Name: name,
|
||||||
ModTime: time.Unix(0x666, 0),
|
ModTime: time.Unix(0x666, 0),
|
||||||
Size: 0xa,
|
Size: 0xa,
|
||||||
Type: protocol.FileInfoTypeFile,
|
Type: protocol.FileInfoTypeFile.String(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
d := func(name string, entries ...*TreeEntry) *TreeEntry {
|
d := func(name string, entries ...*TreeEntry) *TreeEntry {
|
||||||
@ -1737,7 +1737,7 @@ func TestGlobalDirectoryTree(t *testing.T) {
|
|||||||
Name: name,
|
Name: name,
|
||||||
ModTime: time.Unix(0x666, 0),
|
ModTime: time.Unix(0x666, 0),
|
||||||
Size: 128,
|
Size: 128,
|
||||||
Type: protocol.FileInfoTypeDirectory,
|
Type: protocol.FileInfoTypeDirectory.String(),
|
||||||
Children: entries,
|
Children: entries,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user