mirror of
https://github.com/bluenviron/mediamtx.git
synced 2026-01-25 21:09:15 -08:00
raise an error in case recordPath is incompatible with the playback server (#3356)
This commit is contained in:
parent
6debb52abd
commit
c0ad6e4dc5
2 changed files with 25 additions and 0 deletions
|
|
@ -281,6 +281,15 @@ func TestConfErrors(t *testing.T) {
|
|||
" ~^.*$:\n",
|
||||
`all_others, all and '~^.*$' are aliases`,
|
||||
},
|
||||
{
|
||||
"playback",
|
||||
"playback: yes\n" +
|
||||
"paths:\n" +
|
||||
" my_path:\n" +
|
||||
" recordPath: ./recordings/%path/%Y-%m-%d_%H-%M-%S",
|
||||
`record path './recordings/%path/%Y-%m-%d_%H-%M-%S' is missing one of the` +
|
||||
` mandatory elements for the playback server to work: %Y %m %d %H %M %S %f`,
|
||||
},
|
||||
} {
|
||||
t.Run(ca.name, func(t *testing.T) {
|
||||
tmpf, err := createTempFile([]byte(ca.conf))
|
||||
|
|
|
|||
|
|
@ -378,6 +378,22 @@ func (pconf *Path) validate(
|
|||
}
|
||||
}
|
||||
|
||||
// Record
|
||||
|
||||
if conf.Playback {
|
||||
if !strings.Contains(pconf.RecordPath, "%Y") ||
|
||||
!strings.Contains(pconf.RecordPath, "%m") ||
|
||||
!strings.Contains(pconf.RecordPath, "%d") ||
|
||||
!strings.Contains(pconf.RecordPath, "%H") ||
|
||||
!strings.Contains(pconf.RecordPath, "%M") ||
|
||||
!strings.Contains(pconf.RecordPath, "%S") ||
|
||||
!strings.Contains(pconf.RecordPath, "%f") {
|
||||
return fmt.Errorf("record path '%s' is missing one of the mandatory elements"+
|
||||
" for the playback server to work: %%Y %%m %%d %%H %%M %%S %%f",
|
||||
pconf.RecordPath)
|
||||
}
|
||||
}
|
||||
|
||||
// Authentication (deprecated)
|
||||
|
||||
if deprecatedCredentialsMode {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue