mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-07-29 12:42:46 +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
|
@ -23,7 +23,7 @@ type MediaAPI struct {
|
|||
// The maximum file size in bytes that is allowed to be stored on this server.
|
||||
// Note: if max_file_size_bytes is set to 0, the size is unlimited.
|
||||
// Note: if max_file_size_bytes is not set, it will default to 10485760 (10MB)
|
||||
MaxFileSizeBytes *FileSizeBytes `yaml:"max_file_size_bytes,omitempty"`
|
||||
MaxFileSizeBytes FileSizeBytes `yaml:"max_file_size_bytes,omitempty"`
|
||||
|
||||
// Whether to dynamically generate thumbnails on-the-fly if the requested resolution is not already generated
|
||||
DynamicThumbnails bool `yaml:"dynamic_thumbnails"`
|
||||
|
@ -48,7 +48,7 @@ func (c *MediaAPI) Defaults(generate bool) {
|
|||
c.BasePath = "./media_store"
|
||||
}
|
||||
|
||||
c.MaxFileSizeBytes = &DefaultMaxFileSizeBytes
|
||||
c.MaxFileSizeBytes = DefaultMaxFileSizeBytes
|
||||
c.MaxThumbnailGenerators = 10
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ func (c *MediaAPI) Verify(configErrs *ConfigErrors, isMonolith bool) {
|
|||
checkNotEmpty(configErrs, "media_api.database.connection_string", string(c.Database.ConnectionString))
|
||||
|
||||
checkNotEmpty(configErrs, "media_api.base_path", string(c.BasePath))
|
||||
checkPositive(configErrs, "media_api.max_file_size_bytes", int64(*c.MaxFileSizeBytes))
|
||||
checkPositive(configErrs, "media_api.max_file_size_bytes", int64(c.MaxFileSizeBytes))
|
||||
checkPositive(configErrs, "media_api.max_thumbnail_generators", int64(c.MaxThumbnailGenerators))
|
||||
|
||||
for i, size := range c.ThumbnailSizes {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue