mirror of
https://github.com/datarhei/core.git
synced 2025-09-27 04:16:25 +08:00
Fix validating a tee muxer address with only one output
This commit is contained in:
@@ -729,7 +729,9 @@ func (r *restream) validateInputAddress(address, basedir string) (string, error)
|
||||
}
|
||||
|
||||
func (r *restream) validateOutputAddress(address, basedir string) (string, bool, error) {
|
||||
if strings.Contains(address, "|") {
|
||||
// If the address contains a "|" or it starts with a "[", then assume that it
|
||||
// is an address for the tee muxer.
|
||||
if strings.Contains(address, "|") || strings.HasPrefix(address, "[") {
|
||||
addresses := strings.Split(address, "|")
|
||||
|
||||
isFile := false
|
||||
|
@@ -469,6 +469,7 @@ func TestOutputAddressValidation(t *testing.T) {
|
||||
"-": {"pipe:", false},
|
||||
"/core/data/foobar|http://example.com": {"file:/core/data/foobar|http://example.com", false},
|
||||
"/core/data/foobar|/etc/passwd": {"/core/data/foobar|/etc/passwd", true},
|
||||
"[f=mpegts]udp://10.0.1.255:1234/": {"[f=mpegts]udp://10.0.1.255:1234/", false},
|
||||
"[f=null]-|[f=null]-": {"[f=null]pipe:|[f=null]pipe:", false},
|
||||
"[onfail=ignore]/core/data/archive-20121107.mkv|[f=mpegts]udp://10.0.1.255:1234/": {"[onfail=ignore]file:/core/data/archive-20121107.mkv|[f=mpegts]udp://10.0.1.255:1234/", false},
|
||||
}
|
||||
|
Reference in New Issue
Block a user