Skip to content

Commit 5389b3a

Browse files
committed
fix /auth=TOKEN not being stripped
1 parent bc68083 commit 5389b3a

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

internals/proxy/middlewares/auth.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,11 +183,13 @@ var PathAuth = AuthMethod{
183183
Authenticate: func(w http.ResponseWriter, req *http.Request, tokens []string) (string, error) {
184184
parts := strings.Split(req.URL.Path, "/")
185185

186-
if len(parts) == 0 {
186+
if len(parts) <= 1 {
187187
return "", nil
188188
}
189189

190-
unescaped, err := url.PathUnescape(parts[1])
190+
parts = parts[1:]
191+
192+
unescaped, err := url.PathUnescape(parts[0])
191193

192194
if err != nil {
193195
return "", nil
@@ -199,6 +201,8 @@ var PathAuth = AuthMethod{
199201
return "", nil
200202
}
201203

204+
req.URL.Path = "/" + strings.Join(parts[1:], "/")
205+
202206
if isValidToken(tokens, auth) {
203207
return auth, nil
204208
}

0 commit comments

Comments
 (0)