cmd/streamdata: check against overwriting
This prevents inadvertently queuing an existing vod, only to fail the check after copy completes. Signed-off-by: Yonah <contrib@gensokyo.uk>
This commit is contained in:
@@ -112,6 +112,16 @@ func main() {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var e *streamdata.VOD
|
||||||
|
if e, err = channel.Load(&ident); err != nil {
|
||||||
|
if !errors.Is(err, os.ErrNotExist) {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
printVOD(e)
|
||||||
|
return errors.New("attempting to overwrite existing vod")
|
||||||
|
}
|
||||||
|
|
||||||
return channel.Add(&ident, func(
|
return channel.Add(&ident, func(
|
||||||
v *streamdata.VOD,
|
v *streamdata.VOD,
|
||||||
w io.Writer,
|
w io.Writer,
|
||||||
|
|||||||
Reference in New Issue
Block a user