Browse Source

提交代码。

Signed-off-by: zouap <zouap@pcl.ac.cn>
tags/v1.22.3.2^2
zouap 3 years ago
parent
commit
bc6846dc81
1 changed files with 3 additions and 8 deletions
  1. +3
    -8
      routers/search.go

+ 3
- 8
routers/search.go View File

@@ -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


Loading…
Cancel
Save