mirror of
https://github.com/SagerNet/sing-box.git
synced 2024-11-14 12:53:17 +00:00
18 lines
361 B
Go
18 lines
361 B
Go
|
package clashapi
|
||
|
|
||
|
import (
|
||
|
"net/http"
|
||
|
"net/url"
|
||
|
|
||
|
"github.com/go-chi/chi/v5"
|
||
|
)
|
||
|
|
||
|
// When name is composed of a partial escape string, Golang does not unescape it
|
||
|
func getEscapeParam(r *http.Request, paramName string) string {
|
||
|
param := chi.URLParam(r, paramName)
|
||
|
if newParam, err := url.PathUnescape(param); err == nil {
|
||
|
param = newParam
|
||
|
}
|
||
|
return param
|
||
|
}
|