Fix extracting domain from path
This commit is contained in:
parent
de1818a6b0
commit
cf5192977b
17
srt/srt.go
17
srt/srt.go
@ -5,6 +5,7 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
@ -514,8 +515,22 @@ func (s *server) findIdentityFromToken(key string) (string, error) {
|
||||
return identity.Name(), nil
|
||||
}
|
||||
|
||||
func splitPath(path string) []string {
|
||||
pathElements := strings.Split(filepath.Clean(path), "/")
|
||||
|
||||
if len(pathElements) == 0 {
|
||||
return pathElements
|
||||
}
|
||||
|
||||
if len(pathElements[0]) == 0 {
|
||||
pathElements = pathElements[1:]
|
||||
}
|
||||
|
||||
return pathElements
|
||||
}
|
||||
|
||||
func (s *server) findDomainFromPlaypath(path string) string {
|
||||
elements := strings.Split(path, "/")
|
||||
elements := splitPath(path)
|
||||
if len(elements) == 1 {
|
||||
return "$none"
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user