1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-23 02:38:35 +00:00

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
This commit is contained in:
Lunny Xiao
2020-10-14 21:07:51 +08:00
committed by GitHub
parent 93f7525061
commit 80a6b0f5bc
21 changed files with 705 additions and 477 deletions

View File

@@ -30,7 +30,6 @@ import (
mirror_service "code.gitea.io/gitea/services/mirror"
repo_service "code.gitea.io/gitea/services/repository"
"github.com/unknwon/com"
"mvdan.cc/xurls/v2"
)
@@ -928,7 +927,7 @@ func UpdateAvatarSetting(ctx *context.Context, form auth.AvatarForm) error {
// No avatar is uploaded and we not removing it here.
// No random avatar generated here.
// Just exit, no action.
if !com.IsFile(ctxRepo.CustomAvatarPath()) {
if ctxRepo.CustomAvatarRelativePath() == "" {
log.Trace("No avatar was uploaded for repo: %d. Default icon will appear instead.", ctxRepo.ID)
}
return nil
@@ -940,7 +939,7 @@ func UpdateAvatarSetting(ctx *context.Context, form auth.AvatarForm) error {
}
defer r.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"))
}