diff --git a/src/NzbDrone.Core.Test/OrganizerTests/FileNameBuilderTests/FileNameBuilderFixture.cs b/src/NzbDrone.Core.Test/OrganizerTests/FileNameBuilderTests/FileNameBuilderFixture.cs index f6c448e8a..48cd3fc00 100644 --- a/src/NzbDrone.Core.Test/OrganizerTests/FileNameBuilderTests/FileNameBuilderFixture.cs +++ b/src/NzbDrone.Core.Test/OrganizerTests/FileNameBuilderTests/FileNameBuilderFixture.cs @@ -770,6 +770,20 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests Mocker.GetMock().Verify(v => v.Update(_episodeFile, _series), Times.Once()); } + [Test] + public void should_not_update_media_info_if_no_series_path_available() + { + _namingConfig.StandardEpisodeFormat = + "{Series.Title}.S{season:00}E{episode:00}.{Episode.Title}.{MediaInfo VideoDynamicRange}"; + + GivenMediaInfoModel(schemaRevision: 3); + _series.Path = null; + + Subject.BuildFileName(new List { _episode1 }, _series, _episodeFile); + + Mocker.GetMock().Verify(v => v.Update(_episodeFile, _series), Times.Never()); + } + [Test] public void should_not_update_media_info_if_token_not_configured_and_revision_is_old() { diff --git a/src/NzbDrone.Core/Organizer/FileNameBuilder.cs b/src/NzbDrone.Core/Organizer/FileNameBuilder.cs index c604f1b27..e9235cfc6 100644 --- a/src/NzbDrone.Core/Organizer/FileNameBuilder.cs +++ b/src/NzbDrone.Core/Organizer/FileNameBuilder.cs @@ -658,6 +658,11 @@ namespace NzbDrone.Core.Organizer private void UpdateMediaInfoIfNeeded(string pattern, EpisodeFile episodeFile, Series series) { + if (series.Path.IsNullOrWhiteSpace()) + { + return; + } + var schemaRevision = episodeFile.MediaInfo != null ? episodeFile.MediaInfo.SchemaRevision : 0; var matches = TitleRegex.Matches(pattern);