MM-41728: Validate emoji size in app while importing (#20325)

* MM-41728: Validate emoji size in app on import

* use NotNil instead of Error for AppErr

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
Ashish Bhate
2022-06-03 09:25:40 +05:30
коммит произвёл GitHub
родитель c975fdc982
Коммит 1f6e2fe846
3 изменённых файлов: 9 добавлений и 1 удалений

Просмотреть файл

@@ -1867,7 +1867,8 @@ func (a *App) importEmoji(data *EmojiImportData, dryRun bool) *model.AppError {
}
defer file.Close()
if _, err := a.WriteFile(file, getEmojiImagePath(emoji.Id)); err != nil {
reader := utils.NewLimitedReaderWithError(file, MaxEmojiFileSize)
if _, err := a.WriteFile(reader, getEmojiImagePath(emoji.Id)); err != nil {
return err
}