From 7e2b539de484ac4f2e97eafce6b8d63ffa2caf13 Mon Sep 17 00:00:00 2001 From: Thomas Balthazar Date: Tue, 24 May 2016 15:07:42 +0200 Subject: Max_File_Size setting in System Console > File Settings (#3070) --- model/config.go | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'model/config.go') diff --git a/model/config.go b/model/config.go index ecfd18710..08b00b90f 100644 --- a/model/config.go +++ b/model/config.go @@ -92,6 +92,7 @@ type LogSettings struct { } type FileSettings struct { + MaxFileSize *int64 DriverName string Directory string EnablePublicLink bool @@ -263,6 +264,11 @@ func (o *Config) SetDefaults() { o.SqlSettings.AtRestEncryptKey = NewRandomString(32) } + if o.FileSettings.MaxFileSize == nil { + o.FileSettings.MaxFileSize = new(int64) + *o.FileSettings.MaxFileSize = 52428800 // 50 MB + } + if len(o.FileSettings.PublicLinkSalt) == 0 { o.FileSettings.PublicLinkSalt = NewRandomString(32) } @@ -569,6 +575,10 @@ func (o *Config) IsValid() *AppError { return NewLocAppError("Config.IsValid", "model.config.is_valid.sql_max_conn.app_error", nil, "") } + if *o.FileSettings.MaxFileSize <= 0 { + return NewLocAppError("Config.IsValid", "model.config.is_valid.max_file_size.app_error", nil, "") + } + if !(o.FileSettings.DriverName == IMAGE_DRIVER_LOCAL || o.FileSettings.DriverName == IMAGE_DRIVER_S3) { return NewLocAppError("Config.IsValid", "model.config.is_valid.file_driver.app_error", nil, "") } -- cgit v1.2.3-1-g7c22