several one-line panic, race, and logic fixes (#7766)

Этот коммит содержится в:
Chris
2017-11-03 10:25:38 -05:00
коммит произвёл Corey Hulen
родитель 9d32cd4208
Коммит d5dbdb2737
17 изменённых файлов: 39 добавлений и 27 удалений

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

@@ -774,10 +774,10 @@ func (a *App) GetProfileImage(user *model.User) ([]byte, bool, *model.AppError)
func (a *App) SetProfileImage(userId string, imageData *multipart.FileHeader) *model.AppError {
file, err := imageData.Open()
defer file.Close()
if err != nil {
return model.NewAppError("SetProfileImage", "api.user.upload_profile_user.open.app_error", nil, err.Error(), http.StatusBadRequest)
}
defer file.Close()
// Decode image config first to check dimensions before loading the whole thing into memory later on
config, _, err := image.DecodeConfig(file)