From f81035f3ecf0c02eaf94d6cba4ac07dfd757012c Mon Sep 17 00:00:00 2001
From: liuxiaolong <736321739@qq.com>
Date: 星期五, 16 八月 2019 13:39:48 +0800
Subject: [PATCH] add log

---
 middlewares/auth/auth.go |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/middlewares/auth/auth.go b/middlewares/auth/auth.go
index 13f8cc4..55f505c 100644
--- a/middlewares/auth/auth.go
+++ b/middlewares/auth/auth.go
@@ -5,6 +5,7 @@
 	"net/http"
 	"strings"
 	"webserver/extend/config"
+	"webserver/extend/logger"
 )
 
 const (
@@ -36,8 +37,18 @@
 			c.Next()
 		} else if strings.HasPrefix(urlPath,"/httpImage") {
 			imgUrl := config.Server.ImageUrl
+			idx := strings.Index(urlPath, ":")
+			tmpPath := urlPath
+			if idx >-1 {//璺緞涓寘鍚湁绔彛,鍙栫鍙d互鍚庤矾寰�
+				tmpPath = urlPath[idx:]
+				imgIndx := strings.Index(imgUrl, ":")
+				if imgIndx > -1 {
+					imgUrl = imgUrl[:imgIndx-1]
+				}
+			}
+			logger.Debug("imgUrl+tmpPath:", imgUrl+tmpPath)
 			c.Header("Access-Control-Allow-Origin","*")
-			c.Redirect(http.StatusMovedPermanently, imgUrl+urlPath[10:])
+			c.Redirect(http.StatusMovedPermanently, imgUrl+tmpPath)
 			return
 		} else {
 			c.Next()

--
Gitblit v1.8.0