mirror of
https://github.com/jech/galene.git
synced 2024-11-09 02:05:59 +01:00
Disallow unknown fields in group descriptions.
Make the de-facto "comment" and "contact" fields official.
This commit is contained in:
parent
61990ff1ef
commit
98235afe06
2 changed files with 6 additions and 0 deletions
3
README
3
README
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue