Refactor delete
This commit is contained in:
@@ -36,13 +36,13 @@ func HandleDeleteFile(directory, torrentName, fileName string, torMgr *torrent.T
|
||||
dirCfg := torMgr.Config.(*config.ZurgConfigV1).GetDirectoryConfig(directory)
|
||||
if dirCfg.OnlyShowTheBiggestFile {
|
||||
torMgr.Delete(torrentName, true)
|
||||
} else {
|
||||
if err := file.State.Event(context.Background(), "delete_file"); err != nil {
|
||||
return fmt.Errorf("cannot delete file %s: %v", fileName, err)
|
||||
}
|
||||
if torMgr.CheckDeletedStatus(torrent) {
|
||||
torMgr.Delete(torrentName, true)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
if err := file.State.Event(context.Background(), "delete_file"); err != nil {
|
||||
return fmt.Errorf("cannot delete file %s: %v", fileName, err)
|
||||
}
|
||||
if torMgr.CheckDeletedStatus(torrent) {
|
||||
torMgr.Delete(torrentName, true)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user