Skip to content

Commit 825f6f8

Browse files
committed
internal/server: Replace gorilla/mux with http.ServeMux
Signed-off-by: 0xk1f0 <[email protected]>
1 parent c9b9f8f commit 825f6f8

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

internal/server/auth/authorization_objects.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ import (
77
"net/url"
88
"strings"
99

10-
"github.com/gorilla/mux"
11-
1210
"github.com/lxc/incus/v6/internal/version"
1311
)
1412

@@ -191,7 +189,6 @@ func ObjectFromRequest(r *http.Request, objectType ObjectType, expandProject fun
191189
location := values.Get("target")
192190

193191
muxValues := make([]string, 0, len(muxVars))
194-
vars := mux.Vars(r)
195192
for _, muxVar := range muxVars {
196193
var err error
197194
var muxValue string
@@ -201,14 +198,14 @@ func ObjectFromRequest(r *http.Request, objectType ObjectType, expandProject fun
201198
if location != "" {
202199
muxValue = location
203200
} else if objectType == ObjectTypeStorageVolume {
204-
muxValue = expandVolumeLocation(projectName, vars["poolName"], vars["type"], vars["volumeName"])
201+
muxValue = expandVolumeLocation(projectName, r.PathValue("poolName"), r.PathValue("type"), r.PathValue("volumeName"))
205202
}
206203

207204
if muxValue == "" {
208205
continue
209206
}
210207
} else {
211-
muxValue, err = url.PathUnescape(vars[muxVar])
208+
muxValue, err = url.PathUnescape(r.PathValue(muxVar))
212209
if err != nil {
213210
return "", fmt.Errorf("Failed to unescape mux var %q for object type %q: %w", muxVar, objectType, err)
214211
}

0 commit comments

Comments
 (0)