Commit 98235afe authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Disallow unknown fields in group descriptions.

Make the de-facto "comment" and "contact" fields official.
parent 61990ff1
......@@ -224,6 +224,9 @@ the group.
- `public`: if true, then the group is visible on the landing page;
- `description`: a human-readable description of the group; this is
displayed on the landing page for public groups;
- `contact`: a human-readable contact for this group, such as an e-mail
address;
- `comment`: a human-readable string;
- `max-clients`: the maximum number of clients that may join the group at
a time;
- `max-history-age`: the time, in seconds, during which chat history is
......
......@@ -659,6 +659,8 @@ type description struct {
modTime time.Time `json:"-"`
fileSize int64 `json:"-"`
Description string `json:"description,omitempty"`
Contact string `json:"contact,omitempty"`
Comment string `json:"comment,omitempty"`
Redirect string `json:"redirect,omitempty"`
Public bool `json:"public,omitempty"`
MaxClients int `json:"max-clients,omitempty"`
......@@ -744,6 +746,7 @@ func GetDescription(name string) (*description, error) {
}
d := json.NewDecoder(r)
d.DisallowUnknownFields()
err = d.Decode(&desc)
if err != nil {
return nil, err
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment