mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-25 15:55:06 -07:00
Fixed: Handling of poorly formed items when parsing results from indexer
This commit is contained in:
parent
36f66eed21
commit
da73221cef
1 changed files with 18 additions and 5 deletions
|
@ -1,4 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
@ -253,12 +253,25 @@ namespace NzbDrone.Core.Indexers
|
||||||
protected virtual RssEnclosure[] GetEnclosures(XElement item)
|
protected virtual RssEnclosure[] GetEnclosures(XElement item)
|
||||||
{
|
{
|
||||||
var enclosures = item.Elements("enclosure")
|
var enclosures = item.Elements("enclosure")
|
||||||
.Select(v => new RssEnclosure
|
.Select(v =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return new RssEnclosure
|
||||||
{
|
{
|
||||||
Url = v.Attribute("url").Value,
|
Url = v.Attribute("url").Value,
|
||||||
Type = v.Attribute("type").Value,
|
Type = v.Attribute("type").Value,
|
||||||
Length = (long)v.Attribute("length")
|
Length = (long)v.Attribute("length")
|
||||||
|
};
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
_logger.Warn(e, "Failed to get enclosure for: {0}", item.Title());
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
})
|
})
|
||||||
|
.Where(v => v != null)
|
||||||
.ToArray();
|
.ToArray();
|
||||||
|
|
||||||
return enclosures;
|
return enclosures;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue