mirror of
https://github.com/Prowlarr/Prowlarr
synced 2026-05-05 19:20:19 +02:00
Return bad request for unprotect download link failures
This commit is contained in:
parent
121ef8e80d
commit
8d16b88185
1 changed files with 9 additions and 4 deletions
|
|
@ -255,20 +255,25 @@ public async Task<object> GetDownload(int id, string link, string file)
|
|||
var source = Request.GetSource();
|
||||
var host = Request.GetHostName();
|
||||
|
||||
var unprotectedlLink = _downloadMappingService.ConvertToNormalLink(link);
|
||||
var unprotectedLink = _downloadMappingService.ConvertToNormalLink(link);
|
||||
|
||||
if (unprotectedLink.IsNullOrWhiteSpace())
|
||||
{
|
||||
throw new BadRequestException("Failed to normalize provided link");
|
||||
}
|
||||
|
||||
// If Indexer is set to download via Redirect then just redirect to the link
|
||||
if (indexer.SupportsRedirect && indexerDef.Redirect)
|
||||
{
|
||||
_downloadService.RecordRedirect(unprotectedlLink, id, source, host, file);
|
||||
return RedirectPermanent(unprotectedlLink);
|
||||
_downloadService.RecordRedirect(unprotectedLink, id, source, host, file);
|
||||
return RedirectPermanent(unprotectedLink);
|
||||
}
|
||||
|
||||
byte[] downloadBytes;
|
||||
|
||||
try
|
||||
{
|
||||
downloadBytes = await _downloadService.DownloadReport(unprotectedlLink, id, source, host, file);
|
||||
downloadBytes = await _downloadService.DownloadReport(unprotectedLink, id, source, host, file);
|
||||
}
|
||||
catch (ReleaseUnavailableException ex)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue