Files
decypharr/pkg/webdav/misc.go
2025-03-18 10:02:10 +01:00

15 lines
384 B
Go

package webdav
import "strings"
// getName: Returns the torrent name and filename from the path
// /webdav/alldebrid/__all__/TorrentName
func getName(rootDir, path string) (string, string) {
path = strings.TrimPrefix(path, rootDir)
parts := strings.Split(strings.TrimPrefix(path, "/"), "/")
if len(parts) < 2 {
return "", ""
}
return parts[0], strings.Join(parts[1:], "/")
}