mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-01 11:13:12 -06:00
Return "null" if MaxFileSizeBytes is 0
This commit is contained in:
parent
bfa344e831
commit
eb7e81ca4f
|
|
@ -35,7 +35,7 @@ import (
|
||||||
// configResponse is the response to GET /_matrix/media/r0/config
|
// configResponse is the response to GET /_matrix/media/r0/config
|
||||||
// https://matrix.org/docs/spec/client_server/latest#get-matrix-media-r0-config
|
// https://matrix.org/docs/spec/client_server/latest#get-matrix-media-r0-config
|
||||||
type configResponse struct {
|
type configResponse struct {
|
||||||
UploadSize config.FileSizeBytes `json:"m.upload.size"`
|
UploadSize *config.FileSizeBytes `json:"m.upload.size"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup registers the media API HTTP handlers
|
// Setup registers the media API HTTP handlers
|
||||||
|
|
@ -73,9 +73,13 @@ func Setup(
|
||||||
if r := rateLimits.Limit(req); r != nil {
|
if r := rateLimits.Limit(req); r != nil {
|
||||||
return *r
|
return *r
|
||||||
}
|
}
|
||||||
|
respondSize := cfg.MaxFileSizeBytes
|
||||||
|
if *cfg.MaxFileSizeBytes == 0 {
|
||||||
|
respondSize = nil
|
||||||
|
}
|
||||||
return util.JSONResponse{
|
return util.JSONResponse{
|
||||||
Code: http.StatusOK,
|
Code: http.StatusOK,
|
||||||
JSON: configResponse{UploadSize: *cfg.MaxFileSizeBytes},
|
JSON: configResponse{UploadSize: respondSize},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue