mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-10-28 22:32:24 -05:00
[bugfix] Allow instance thumbnail description to be set separately from image (#1417)
This commit is contained in:
parent
04ac3f8acf
commit
80c26d61f7
3 changed files with 212 additions and 171 deletions
|
|
@ -178,19 +178,17 @@ func validateInstanceUpdate(form *apimodel.InstanceSettingsUpdateRequest) error
|
|||
return errors.New("empty form submitted")
|
||||
}
|
||||
|
||||
maxImageSize := config.GetMediaImageMaxSize()
|
||||
maxDescriptionChars := config.GetMediaDescriptionMaxChars()
|
||||
|
||||
// validate avatar if present
|
||||
if form.Avatar != nil {
|
||||
maxImageSize := config.GetMediaImageMaxSize()
|
||||
if size := form.Avatar.Size; size > int64(maxImageSize) {
|
||||
return fmt.Errorf("file size limit exceeded: limit is %d bytes but desired instance avatar was %d bytes", maxImageSize, size)
|
||||
}
|
||||
}
|
||||
|
||||
if form.AvatarDescription != nil {
|
||||
if length := len([]rune(*form.AvatarDescription)); length > maxDescriptionChars {
|
||||
return fmt.Errorf("avatar description length must be less than %d characters (inclusive), but provided avatar description was %d chars", maxDescriptionChars, length)
|
||||
}
|
||||
if form.AvatarDescription != nil {
|
||||
maxDescriptionChars := config.GetMediaDescriptionMaxChars()
|
||||
if length := len([]rune(*form.AvatarDescription)); length > maxDescriptionChars {
|
||||
return fmt.Errorf("avatar description length must be less than %d characters (inclusive), but provided avatar description was %d chars", maxDescriptionChars, length)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue