Skip to content

Commit

Permalink
Fix extracting domain from path
Browse files Browse the repository at this point in the history
  • Loading branch information
ioppermann committed Feb 12, 2024
1 parent de1818a commit cf51929
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion srt/srt.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"context"
"fmt"
"net"
"path/filepath"
"strings"
"sync"
"time"
Expand Down Expand Up @@ -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"
}
Expand Down

0 comments on commit cf51929

Please sign in to comment.