diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2020-10-14 21:07:51 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-14 21:07:51 +0800 |
commit | 80a6b0f5bce15a641fc75f5f1ef6e42ef54424bc (patch) | |
tree | 504c7ccdc9cb42e0e282abdd8dbb75c4b24e9f5b /routers/user | |
parent | 93f7525061bc9e6f5be734aba0de31b64c63d7a8 (diff) | |
download | gitea-80a6b0f5bce15a641fc75f5f1ef6e42ef54424bc.tar.gz gitea-80a6b0f5bce15a641fc75f5f1ef6e42ef54424bc.zip |
Avatars and Repo avatars support storing in minio (#12516)
* Avatar support minio
* Support repo avatar minio storage
* Add missing migration
* Fix bug
* Fix test
* Add test for minio store type on avatars and repo avatars; Add documents
* Fix bug
* Fix bug
* Add back missed avatar link method
* refactor codes
* Simplify the codes
* Code improvements
* Fix lint
* Fix test mysql
* Fix test mysql
* Fix test mysql
* Fix settings
* Fix test
* fix test
* Fix bug
Diffstat (limited to 'routers/user')
-rw-r--r-- | routers/user/setting/profile.go | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/routers/user/setting/profile.go b/routers/user/setting/profile.go index fe0506946a..1cb00aa77f 100644 --- a/routers/user/setting/profile.go +++ b/routers/user/setting/profile.go @@ -20,7 +20,6 @@ import ( "code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/setting" - "github.com/unknwon/com" "github.com/unknwon/i18n" ) @@ -133,7 +132,7 @@ func UpdateAvatarSetting(ctx *context.Context, form auth.AvatarForm, ctxUser *mo } defer fr.Close() - if form.Avatar.Size > setting.AvatarMaxFileSize { + if form.Avatar.Size > setting.Avatar.MaxFileSize { return errors.New(ctx.Tr("settings.uploaded_avatar_is_too_big")) } @@ -147,7 +146,7 @@ func UpdateAvatarSetting(ctx *context.Context, form auth.AvatarForm, ctxUser *mo if err = ctxUser.UploadAvatar(data); err != nil { return fmt.Errorf("UploadAvatar: %v", err) } - } else if ctxUser.UseCustomAvatar && !com.IsFile(ctxUser.CustomAvatarPath()) { + } else if ctxUser.UseCustomAvatar && ctxUser.Avatar == "" { // No avatar is uploaded but setting has been changed to enable, // generate a random one when needed. if err := ctxUser.GenerateRandomAvatar(); err != nil { |