Skip to content

Commit 92724c3

Browse files
fix(runner/vod): Apply suggestions from comments
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 8ecb1cd commit 92724c3

2 files changed

Lines changed: 16 additions & 4 deletions

File tree

runner/handlers.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,5 +63,5 @@ func (r *Runner) HandleVOD(_ context.Context, req *protobuf.HandleVODRequest) (*
6363
jID := r.RunAction(a, data, r.log.With("stream_id", req.GetStreamId(), "stream_version", req.GetVersion(), "input", req.GetFilepath()))
6464
r.log.Info("job added", "ID", jID)
6565

66-
return &protobuf.HandleVODResponse{}, nil
66+
return &protobuf.HandleVODResponse{JobId: ptr.Take(jID)}, nil
6767
}

runner/pkg/actions/mkvod.go

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,17 @@ func MkVOD(ctx context.Context, logger *slog.Logger, notify chan *protobuf.Notif
3333
}
3434
var recording string
3535
if rec, ok := d["recording"]; ok {
36-
recording = rec.(string)
36+
if recStr, ok := rec.(string); ok {
37+
recording = recStr
38+
} else {
39+
return AbortingError(fmt.Errorf("recording value is not a string"))
40+
}
3741
} else if dir, ok := d["recordingDir"]; ok {
38-
recording = path.Join(dir.(string), "playlist.m3u8")
42+
if dirStr, ok := dir.(string); ok {
43+
recording = path.Join(dirStr, "playlist.m3u8")
44+
} else {
45+
return AbortingError(fmt.Errorf("recordingDir value is not a string"))
46+
}
3947
} else {
4048
return AbortingError(fmt.Errorf("no recording or recordingDir in context"))
4149
}
@@ -52,7 +60,11 @@ func MkVOD(ctx context.Context, logger *slog.Logger, notify chan *protobuf.Notif
5260
// Check if re-encoding is needed
5361
var reencode bool
5462
if needsReencode, ok := d["needsReencode"]; ok {
55-
reencode = needsReencode.(bool)
63+
if reencodeVal, ok := needsReencode.(bool); ok {
64+
reencode = reencodeVal
65+
} else {
66+
return AbortingError(fmt.Errorf("needsReencode is not a bool"))
67+
}
5668
}
5769

5870
var videoCodec, audioCodec string

0 commit comments

Comments
 (0)