trim / in url

This commit is contained in:
Wenkai Yin 2017-07-13 17:12:53 +08:00
parent c4fbc707af
commit 5c965719a2

View File

@ -18,6 +18,7 @@ import (
"context"
"fmt"
"net/http"
"strings"
beegoctx "github.com/astaxie/beego/context"
"github.com/vmware/harbor/src/common/models"
@ -172,7 +173,7 @@ func (b *basicAuthReqCtxModifier) Modify(ctx *beegoctx.Context) bool {
}
func filterReq(req *http.Request) bool {
path := req.URL.Path
path := strings.TrimRight(req.URL.Path, "/")
if path == "/api/projects" && req.Method == http.MethodPost ||
path == "/service/token" && req.Method == http.MethodGet {
return true