style: 优化网站列表描述信息显示 (#4726)

This commit is contained in:
ssongliu 2024-04-26 16:13:53 +08:00 committed by GitHub
parent 5532636e02
commit 6e635c691d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 10 additions and 14 deletions

View file

@ -314,6 +314,7 @@ func (f FileOp) DownloadFile(url, dst string) error {
if err != nil { if err != nil {
return err return err
} }
defer resp.Body.Close()
out, err := os.Create(dst) out, err := os.Create(dst)
if err != nil { if err != nil {
@ -324,8 +325,6 @@ func (f FileOp) DownloadFile(url, dst string) error {
if _, err = io.Copy(out, resp.Body); err != nil { if _, err = io.Copy(out, resp.Body); err != nil {
return fmt.Errorf("save download file [%s] error, err %s", dst, err.Error()) return fmt.Errorf("save download file [%s] error, err %s", dst, err.Error())
} }
out.Close()
resp.Body.Close()
return nil return nil
} }

View file

@ -3,7 +3,6 @@ package files
import ( import (
"bufio" "bufio"
"fmt" "fmt"
"github.com/spf13/afero"
"io" "io"
"net/http" "net/http"
"os" "os"
@ -12,6 +11,8 @@ import (
"strconv" "strconv"
"strings" "strings"
"sync" "sync"
"github.com/spf13/afero"
) )
func IsSymlink(mode os.FileMode) bool { func IsSymlink(mode os.FileMode) bool {
@ -144,8 +145,5 @@ func GetParentMode(path string) (os.FileMode, error) {
} }
func IsInvalidChar(name string) bool { func IsInvalidChar(name string) bool {
if strings.Contains(name, "&") { return strings.Contains(name, "&")
return true
}
return false
} }

View file

@ -43,7 +43,6 @@ func GetHttpRes(url string) (*http.Response, error) {
return nil, buserr.WithMap("ErrHttpReqFailed", map[string]interface{}{"err": err.Error()}, err) return nil, buserr.WithMap("ErrHttpReqFailed", map[string]interface{}{"err": err.Error()}, err)
} }
} }
defer resp.Body.Close()
if resp.StatusCode == 404 { if resp.StatusCode == 404 {
return nil, buserr.New("ErrHttpReqNotFound") return nil, buserr.New("ErrHttpReqNotFound")
} }

View file

@ -111,11 +111,12 @@
</el-button> </el-button>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column :label="$t('website.remark')" prop="remark" min-width="120px"> <el-table-column
<template #default="{ row }"> :label="$t('website.remark')"
<MsgInfo :info="row.remark" /> prop="remark"
</template> show-overflow-tooltip
</el-table-column> min-width="120px"
></el-table-column>
<el-table-column <el-table-column
:label="$t('commons.table.protocol')" :label="$t('commons.table.protocol')"
prop="protocol" prop="protocol"
@ -194,7 +195,6 @@ import { dateFormatSimple } from '@/utils/util';
import { MsgSuccess } from '@/utils/message'; import { MsgSuccess } from '@/utils/message';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { VideoPlay, VideoPause } from '@element-plus/icons-vue'; import { VideoPlay, VideoPause } from '@element-plus/icons-vue';
import MsgInfo from '@/components/msg-info/index.vue';
import { GetGroupList } from '@/api/modules/group'; import { GetGroupList } from '@/api/modules/group';
import { Group } from '@/api/interface/group'; import { Group } from '@/api/interface/group';
import { GlobalStore } from '@/store'; import { GlobalStore } from '@/store';