mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-08-02 06:12:45 +00:00
Return null
if MaxFileSizeBytes is 0 (#2409)
* Return "null" if MaxFileSizeBytes is 0 * Add comment and nil check (better save than sorry) * Simplify config
This commit is contained in:
parent
bfa344e831
commit
979a551f1e
5 changed files with 21 additions and 18 deletions
|
@ -35,7 +35,7 @@ import (
|
|||
// configResponse is the response to GET /_matrix/media/r0/config
|
||||
// https://matrix.org/docs/spec/client_server/latest#get-matrix-media-r0-config
|
||||
type configResponse struct {
|
||||
UploadSize config.FileSizeBytes `json:"m.upload.size"`
|
||||
UploadSize *config.FileSizeBytes `json:"m.upload.size"`
|
||||
}
|
||||
|
||||
// Setup registers the media API HTTP handlers
|
||||
|
@ -73,9 +73,13 @@ func Setup(
|
|||
if r := rateLimits.Limit(req); r != nil {
|
||||
return *r
|
||||
}
|
||||
respondSize := &cfg.MaxFileSizeBytes
|
||||
if cfg.MaxFileSizeBytes == 0 {
|
||||
respondSize = nil
|
||||
}
|
||||
return util.JSONResponse{
|
||||
Code: http.StatusOK,
|
||||
JSON: configResponse{UploadSize: *cfg.MaxFileSizeBytes},
|
||||
JSON: configResponse{UploadSize: respondSize},
|
||||
}
|
||||
})
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue