From fb1962787c029397da4a1516ffa6621895b1c5a8 Mon Sep 17 00:00:00 2001 From: lifei6671 Date: Thu, 12 Jul 2018 13:35:48 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=9B=BE=E7=89=87=E5=AF=BC?= =?UTF-8?q?=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- models/BookResult.go | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/models/BookResult.go b/models/BookResult.go index 9d11f423..204570a0 100644 --- a/models/BookResult.go +++ b/models/BookResult.go @@ -374,8 +374,6 @@ func (m *BookResult) Converter(sessionId string) (ConvertBookResult, error) { if ff, e := ioutil.ReadFile(spath); e == nil { encodeString = base64.StdEncoding.EncodeToString(ff) - }else{ - return } }else{ client := &http.Client{} @@ -391,21 +389,15 @@ func (m *BookResult) Converter(sessionId string) (ConvertBookResult, error) { if body, err := ioutil.ReadAll(resp.Body);err == nil { encodeString = base64.StdEncoding.EncodeToString(body) - }else{ - return } - }else{ - return } - }else{ - return } } + if encodeString != "" { + src = "data:image/" + strings.TrimSuffix(filepath.Ext(src),".") + ";base64," + encodeString - src = "data:image/" + filepath.Ext(src) + ";base64," + encodeString - - contentSelection.SetAttr("src", src) - + contentSelection.SetAttr("src", src) + } } })