From bc6846dc81ecbdf74e4f96aaf674eb4606fa6072 Mon Sep 17 00:00:00 2001 From: zouap Date: Thu, 3 Mar 2022 10:42:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- routers/search.go | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/routers/search.go b/routers/search.go index cd8d76800..d937c881e 100644 --- a/routers/search.go +++ b/routers/search.go @@ -3,6 +3,7 @@ package routers import ( "encoding/json" "fmt" + "path/filepath" "strconv" "strings" @@ -212,9 +213,9 @@ func makeRepoResult(sRes *elastic.SearchResult, Key string, OnlyReturnNum bool) } if recordSource["avatar"] != nil { avatarstr := recordSource["avatar"].(string) - if len(avatarstr) == 0{ + if len(avatarstr) == 0 { record["avatar"] = setting.RepositoryAvatarFallbackImage - }else{ + } else { record["avatar"] = filepath.Join(setting.RepositoryAvatarUploadPath, avatarstr) } } @@ -237,12 +238,6 @@ func makeRepoResult(sRes *elastic.SearchResult, Key string, OnlyReturnNum bool) return returnObj } -avatarPath := repo.CustomAvatarPath() - if len(avatarPath) == 0 || !com.IsFile(avatarPath) { - switch mode := setting.RepositoryAvatarFallback; mode { - case "image": - return setting.RepositoryAvatarFallbackImage - func dealLongText(text string, Key string, MatchedQueries []string) string { var isNeedToDealText bool isNeedToDealText = false