Skip to content

Commit

Permalink
Fixed: Release push with only Magnet URL
Browse files Browse the repository at this point in the history
(cherry picked from commit 9f705e4161af3f4dd55b399d56b0b9c5a36e181b)
  • Loading branch information
markus101 authored and mynameisbogdan committed Mar 14, 2024
1 parent d0df761 commit a397a19
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Readarr.Api.V1/Indexers/ReleasePushController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ public class ReleasePushController : ReleaseControllerBase
_logger = logger;

PostValidator.RuleFor(s => s.Title).NotEmpty();
PostValidator.RuleFor(s => s.DownloadUrl).NotEmpty();
PostValidator.RuleFor(s => s.DownloadUrl).NotEmpty().When(s => s.MagnetUrl.IsNullOrWhiteSpace());
PostValidator.RuleFor(s => s.MagnetUrl).NotEmpty().When(s => s.DownloadUrl.IsNullOrWhiteSpace());
PostValidator.RuleFor(s => s.Protocol).NotEmpty();
PostValidator.RuleFor(s => s.PublishDate).NotEmpty();
}
Expand All @@ -47,7 +48,7 @@ public class ReleasePushController : ReleaseControllerBase
[Consumes("application/json")]
public ActionResult<ReleaseResource> Create(ReleaseResource release)
{
_logger.Info("Release pushed: {0} - {1}", release.Title, release.DownloadUrl);
_logger.Info("Release pushed: {0} - {1}", release.Title, release.DownloadUrl ?? release.MagnetUrl);

ValidateResource(release);

Expand Down

0 comments on commit a397a19

Please sign in to comment.