fix(daemon): report error status when stream path is rejected
This commit is contained in:
parent
d7fa0af504
commit
8fae119903
1 changed files with 9 additions and 0 deletions
|
|
@ -321,6 +321,15 @@ func runDaemonStart() error {
|
||||||
if !isAllowedStreamPath(filePath, cfg.Download.Dir, cfg.Library.ScanPath,
|
if !isAllowedStreamPath(filePath, cfg.Download.Dir, cfg.Library.ScanPath,
|
||||||
cfg.Organize.MoviesDir, cfg.Organize.TVShowsDir) {
|
cfg.Organize.MoviesDir, cfg.Organize.TVShowsDir) {
|
||||||
log.Printf("[%s] stream request rejected: path outside allowed dirs: %s", agent.ShortID(sr.TaskID), filePath)
|
log.Printf("[%s] stream request rejected: path outside allowed dirs: %s", agent.ShortID(sr.TaskID), filePath)
|
||||||
|
go func() {
|
||||||
|
if _, err := agentClient.ReportStatus(ctx, agent.StatusUpdate{
|
||||||
|
TaskID: sr.TaskID,
|
||||||
|
Status: "failed",
|
||||||
|
ErrorMessage: fmt.Sprintf("path outside allowed dirs: %s", filePath),
|
||||||
|
}); err != nil {
|
||||||
|
log.Printf("[%s] stream error report failed: %v", agent.ShortID(sr.TaskID), err)
|
||||||
|
}
|
||||||
|
}()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
info, err := os.Stat(filePath)
|
info, err := os.Stat(filePath)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue