Fixed issue with deleting torrents and a null reference error.

This commit is contained in:
Roger Far 2020-05-16 20:20:37 -06:00
parent 914272d6d7
commit 0220b18017
2 changed files with 4 additions and 6 deletions

View file

@ -67,7 +67,7 @@ namespace RdtClient.Data.Data
var results = await _dataContext.Torrents
.AsNoTracking()
.Include(m => m.Downloads)
.FirstOrDefaultAsync(m => m.Hash == hash);
.FirstOrDefaultAsync(m => m.Hash.ToLower() == hash.ToLower());
if (results != null)
{
@ -86,7 +86,7 @@ namespace RdtClient.Data.Data
{
TorrentId = Guid.NewGuid(),
RdId = realDebridId,
Hash = hash,
Hash = hash.ToLower(),
Status = TorrentStatus.RealDebrid,
AutoDownload = autoDownload,
AutoDelete = autoDelete

View file

@ -142,10 +142,9 @@ namespace RdtClient.Service.Services
var newTorrent = await _torrentData.Add(rdTorrent.Id, rdTorrent.Hash, false, false);
await GetById(newTorrent.TorrentId);
}
if (rdTorrent.Files == null)
else if (rdTorrent.Files == null)
{
var rdTorrent2 = await _rdtClient.GetTorrentInfoAsync(rdTorrent.Id);
var rdTorrent2 = await RdNetClient.GetTorrentInfoAsync(rdTorrent.Id);
await Update(torrent, rdTorrent2);
}
else
@ -360,7 +359,6 @@ namespace RdtClient.Service.Services
if (!rdTorrent.Files.Any(m => m.Selected))
{
var fileIds = rdTorrent.Files
.Where(m => m.Bytes > 1024 * 10)
.Select(m => m.Id.ToString())
.ToArray();