Fixed: Blocklist add fails when publishedDate is missing

DateTime.Parse(null) on the publishedDate value crashed the entire
DownloadFailedEvent handler when an indexer omitted that field,
preventing the blocklist row from being inserted. Use TryParse and
fall back to null — Blocklist.PublishedDate is already DateTime?
and the surrounding fields (Size as long?) follow the same pattern
of treating missing data as unknown rather than synthesizing a value.

Closes #8586
This commit is contained in:
Alex Mittell 2026-05-02 16:47:51 -04:00
parent bf5d48c76a
commit b3d498c543

View file

@ -132,7 +132,7 @@ public void Handle(DownloadFailedEvent message)
SourceTitle = message.SourceTitle,
Quality = message.Quality,
Date = DateTime.UtcNow,
PublishedDate = DateTime.Parse(message.Data.GetValueOrDefault("publishedDate")),
PublishedDate = DateTime.TryParse(message.Data.GetValueOrDefault("publishedDate"), out var publishedDate) ? publishedDate : null,
Size = long.Parse(message.Data.GetValueOrDefault("size", "0")),
Indexer = message.Data.GetValueOrDefault("indexer"),
Protocol = (DownloadProtocol)Convert.ToInt32(message.Data.GetValueOrDefault("protocol")),