From 60b141ef4317f17ad40e464ef79fd82498e482ce Mon Sep 17 00:00:00 2001 From: gazebo Date: Thu, 26 Sep 2019 10:54:32 +0800 Subject: [PATCH] =?UTF-8?q?GetShortNameFromURL=E5=A4=84=E7=90=86=E5=9B=BE?= =?UTF-8?q?=E7=89=87URL=E4=B8=AD=E5=8C=85=E5=90=AB=EF=BC=9F=E5=8F=B7?= =?UTF-8?q?=E7=9A=84=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxutils/jxutils.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/business/jxutils/jxutils.go b/business/jxutils/jxutils.go index f0f13a41e..849394f7c 100644 --- a/business/jxutils/jxutils.go +++ b/business/jxutils/jxutils.go @@ -734,8 +734,13 @@ func BatchString2Slice(strs ...string) (strList []string) { func GetShortNameFromURL(strURL string) (shortName string) { index := strings.LastIndex(strURL, "/") - if index > 0 { - shortName = strURL[index+1:] + index2 := strings.LastIndex(strURL, "?") + if index != -1 { + if index2 == -1 { + shortName = strURL[index+1:] + } else { + shortName = strURL[index+1 : index2] + } } return shortName }