From 2bd94aef2b24f966c6893577bba752d580c20667 Mon Sep 17 00:00:00 2001 From: lanrenwo Date: Mon, 20 Nov 2023 12:24:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=A4=84=E7=90=86Banner?= =?UTF-8?q?=E7=89=B9=E6=AE=8A=E5=AD=97=E7=AC=A6=E7=9A=84=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/handler/link_auth.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/server/handler/link_auth.go b/server/handler/link_auth.go index e9794ad6..9e3dd6f9 100644 --- a/server/handler/link_auth.go +++ b/server/handler/link_auth.go @@ -1,6 +1,7 @@ package handler import ( + "bytes" "crypto/md5" "encoding/xml" "fmt" @@ -14,7 +15,6 @@ import ( "github.com/bjdgyc/anylink/base" "github.com/bjdgyc/anylink/dbdata" "github.com/bjdgyc/anylink/sessdata" - "golang.org/x/net/html" ) var profileHash = "" @@ -155,11 +155,12 @@ func tplRequest(typ int, w io.Writer, data RequestData) { return } - if strings.Contains(data.Banner, "\n") { - // 替换xml文件的换行符 - data.Banner = strings.ReplaceAll(data.Banner, "\n", " ") - data.Banner = html.EscapeString(data.Banner) + if data.Banner != "" { + buf := new(bytes.Buffer) + xml.EscapeText(buf, []byte(data.Banner)) + data.Banner = buf.String() } + t, _ := template.New("auth_complete").Parse(auth_complete) _ = t.Execute(w, data) }