Fix approval hook build

This commit is contained in:
Širhoe Biazhkovič
2021-11-27 00:42:43 +03:00
committed by Lawrence, Rendall
parent 04f1a9efb9
commit e7c5263dd7
2 changed files with 16 additions and 17 deletions

View File

@@ -42,15 +42,14 @@ func (d driver) NewHook(optionBytes []byte, storage storage.Storage) (middleware
}
var confBytes []byte
if confBytes, err = yaml.Marshal(cfg.Options); err != nil {
return nil, err
}
if c, err := container.GetContainer(cfg.Name, confBytes, storage); err == nil {
return &hook{c}, nil
} else {
return nil, err
var h *hook
if confBytes, err = yaml.Marshal(cfg.Options); err == nil {
var c container.Container
if c, err = container.GetContainer(cfg.Name, confBytes, storage); err == nil {
h = &hook{c}
}
}
return h, err
}
// ErrTorrentUnapproved is the error returned when a torrent hash is invalid.