mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-06-14 04:19:36 +03:00
fix(config): fix grpc cofnig parsing when service name only has one '/' char
This commit is contained in:
@ -21,8 +21,13 @@ func (c *Config) getServiceName() string {
|
||||
if !strings.HasPrefix(c.ServiceName, "/") {
|
||||
return url.PathEscape(c.ServiceName)
|
||||
}
|
||||
|
||||
// Otherwise new custom paths
|
||||
rawServiceName := c.ServiceName[1:strings.LastIndex(c.ServiceName, "/")] // trim from first to last '/'
|
||||
lastIndex := strings.LastIndex(c.ServiceName, "/")
|
||||
if lastIndex < 1 {
|
||||
lastIndex = 1
|
||||
}
|
||||
rawServiceName := c.ServiceName[1:lastIndex] // trim from first to last '/'
|
||||
serviceNameParts := strings.Split(rawServiceName, "/")
|
||||
for i := range serviceNameParts {
|
||||
serviceNameParts[i] = url.PathEscape(serviceNameParts[i])
|
||||
|
Reference in New Issue
Block a user