mirror of
https://github.com/Sonarr/Sonarr.git
synced 2026-06-20 05:21:00 +02:00
added input validation around MoveFile
This commit is contained in:
@@ -3,6 +3,7 @@ using System.IO;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Common;
|
||||||
|
using NzbDrone.Common.EnsureThat;
|
||||||
using NzbDrone.Common.EnvironmentInfo;
|
using NzbDrone.Common.EnvironmentInfo;
|
||||||
using NzbDrone.Core.Messaging.Events;
|
using NzbDrone.Core.Messaging.Events;
|
||||||
using NzbDrone.Core.Organizer;
|
using NzbDrone.Core.Organizer;
|
||||||
@@ -59,6 +60,10 @@ namespace NzbDrone.Core.MediaFiles
|
|||||||
|
|
||||||
private void MoveFile(EpisodeFile episodeFile, Series series, string destinationFilename)
|
private void MoveFile(EpisodeFile episodeFile, Series series, string destinationFilename)
|
||||||
{
|
{
|
||||||
|
Ensure.That(() => episodeFile).IsNotNull();
|
||||||
|
Ensure.That(() => series).IsNotNull();
|
||||||
|
Ensure.That(() => destinationFilename).IsValidPath();
|
||||||
|
|
||||||
if (!_diskProvider.FileExists(episodeFile.Path))
|
if (!_diskProvider.FileExists(episodeFile.Path))
|
||||||
{
|
{
|
||||||
throw new FileNotFoundException("Episode file path does not exist", episodeFile.Path);
|
throw new FileNotFoundException("Episode file path does not exist", episodeFile.Path);
|
||||||
|
|||||||
Reference in New Issue
Block a user