Max_File_Size setting in System Console > File Settings (#3070)
Этот коммит содержится в:
коммит произвёл
Harrison Healey
родитель
8e5c318590
Коммит
7e2b539de4
@@ -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, "")
|
||||
}
|
||||
|
||||
@@ -8,10 +8,6 @@ import (
|
||||
"io"
|
||||
)
|
||||
|
||||
const (
|
||||
MAX_FILE_SIZE = 50000000 // 50 MB
|
||||
)
|
||||
|
||||
var (
|
||||
IMAGE_EXTENSIONS = [5]string{".jpg", ".jpeg", ".gif", ".bmp", ".png"}
|
||||
IMAGE_MIME_TYPES = map[string]string{".jpg": "image/jpeg", ".jpeg": "image/jpeg", ".gif": "image/gif", ".bmp": "image/bmp", ".png": "image/png", ".tiff": "image/tiff"}
|
||||
|
||||
Ссылка в новой задаче
Block a user