mirror of
https://github.com/Radarr/Radarr
synced 2026-01-25 08:53:02 +01:00
fix: add empty catch comment and SingleOrDefault safety (#99)
Co-authored-by: admin <admin@ardentleatherworks.com>
This commit is contained in:
parent
1a5ca83f4f
commit
b843e777de
2 changed files with 8 additions and 1 deletions
|
|
@ -86,6 +86,7 @@ protected virtual string GetInfoHash(XElement item)
|
|||
}
|
||||
catch
|
||||
{
|
||||
// Invalid magnet URL format - fall through to return null
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,13 @@ public string AddCacheBreakerToPath(string resourceUrl)
|
|||
return resourceUrl + "?t=" + DateTime.UtcNow.Ticks;
|
||||
}
|
||||
|
||||
var mapper = _diskMappers.Single(m => m.CanHandle(resourceUrl));
|
||||
var mapper = _diskMappers.SingleOrDefault(m => m.CanHandle(resourceUrl));
|
||||
|
||||
if (mapper == null)
|
||||
{
|
||||
return resourceUrl;
|
||||
}
|
||||
|
||||
var pathToFile = mapper.Map(resourceUrl);
|
||||
var hash = _hashProvider.ComputeMd5(pathToFile).ToBase64();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue