| @@ -3,6 +3,7 @@ package routers | |||||
| import ( | import ( | ||||
| "encoding/json" | "encoding/json" | ||||
| "fmt" | "fmt" | ||||
| "path/filepath" | |||||
| "strconv" | "strconv" | ||||
| "strings" | "strings" | ||||
| @@ -212,9 +213,9 @@ func makeRepoResult(sRes *elastic.SearchResult, Key string, OnlyReturnNum bool) | |||||
| } | } | ||||
| if recordSource["avatar"] != nil { | if recordSource["avatar"] != nil { | ||||
| avatarstr := recordSource["avatar"].(string) | avatarstr := recordSource["avatar"].(string) | ||||
| if len(avatarstr) == 0{ | |||||
| if len(avatarstr) == 0 { | |||||
| record["avatar"] = setting.RepositoryAvatarFallbackImage | record["avatar"] = setting.RepositoryAvatarFallbackImage | ||||
| }else{ | |||||
| } else { | |||||
| record["avatar"] = filepath.Join(setting.RepositoryAvatarUploadPath, avatarstr) | record["avatar"] = filepath.Join(setting.RepositoryAvatarUploadPath, avatarstr) | ||||
| } | } | ||||
| } | } | ||||
| @@ -237,12 +238,6 @@ func makeRepoResult(sRes *elastic.SearchResult, Key string, OnlyReturnNum bool) | |||||
| return returnObj | 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 { | func dealLongText(text string, Key string, MatchedQueries []string) string { | ||||
| var isNeedToDealText bool | var isNeedToDealText bool | ||||
| isNeedToDealText = false | isNeedToDealText = false | ||||