From e466765842d21a185f67bfb1a3a02a7a820bc3ec Mon Sep 17 00:00:00 2001 From: sy264115809 <264115809@qq.com> Date: Wed, 23 Aug 2017 11:14:16 +0800 Subject: [PATCH] bugfix: trim relative slash incorrectly in apiBuilder.Party Former-commit-id: 9c41facfe3b99138e80de6f12f6fea191e53cf60 --- core/router/api_builder.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/router/api_builder.go b/core/router/api_builder.go index e0c4939f..c5526ff9 100644 --- a/core/router/api_builder.go +++ b/core/router/api_builder.go @@ -214,8 +214,8 @@ func (api *APIBuilder) Party(relativePath string, handlers ...context.Handler) P } // this is checked later on but for easier debug is better to do it here: - if api.relativePath[0] == '/' && relativePath[0] == '/' { - parentPath = parentPath[1:] // remove first slash if parent ended with / and new one started with /. + if api.relativePath[len(api.relativePath)-1] == '/' && relativePath[0] == '/' { + relativePath = relativePath[1:] // remove first slash if parent ended with / and new one started with /. } // if it's subdomain then it has priority, i.e: