diff --git a/src/NzbDrone.Core.Test/Datastore/Migration/099_extra_and_subtitle_filesFixture.cs b/src/NzbDrone.Core.Test/Datastore/Migration/099_extra_and_subtitle_filesFixture.cs index d18f37fd1..f72d950f0 100644 --- a/src/NzbDrone.Core.Test/Datastore/Migration/099_extra_and_subtitle_filesFixture.cs +++ b/src/NzbDrone.Core.Test/Datastore/Migration/099_extra_and_subtitle_filesFixture.cs @@ -33,6 +33,15 @@ public void should_set_extension_using_relative_path() Type = 5, Consumer = "XbmcMetadata" }); + + c.Insert.IntoTable("MetadataFiles").Row(new + { + SeriesId = 1, + RelativePath = "Series Title", + LastUpdated = "2016-05-30 20:23:02.3725923", + Type = 3, + Consumer = "RoksboxMetadata" + }); }); var items = db.Query("SELECT * FROM MetadataFiles"); diff --git a/src/NzbDrone.Core/Datastore/Migration/099_extra_and_subtitle_files.cs b/src/NzbDrone.Core/Datastore/Migration/099_extra_and_subtitle_files.cs index 60abad5fb..f7a173157 100644 --- a/src/NzbDrone.Core/Datastore/Migration/099_extra_and_subtitle_files.cs +++ b/src/NzbDrone.Core/Datastore/Migration/099_extra_and_subtitle_files.cs @@ -33,6 +33,9 @@ protected override void MainDbUpgrade() .AddColumn("Added").AsDateTime().Nullable() .AddColumn("Extension").AsString().Nullable(); + // Remove Metadata files that don't have an extension + Execute.Sql("DELETE FROM MetadataFiles WHERE RelativePath NOT LIKE '%.%'"); + // Set Extension using the extension from RelativePath Execute.WithConnection(SetMetadataFileExtension); diff --git a/src/NzbDrone.Core/Extras/MetaData/Consumers/Roksbox/RoksboxMetadata.cs b/src/NzbDrone.Core/Extras/MetaData/Consumers/Roksbox/RoksboxMetadata.cs index 072e3428d..de6b17a97 100644 --- a/src/NzbDrone.Core/Extras/MetaData/Consumers/Roksbox/RoksboxMetadata.cs +++ b/src/NzbDrone.Core/Extras/MetaData/Consumers/Roksbox/RoksboxMetadata.cs @@ -195,7 +195,7 @@ public override List SeriesImages(Series series) } var source = _mediaCoverService.GetCoverPath(series.Id, image.CoverType); - var destination = Path.Combine(series.Path, Path.GetFileName(series.Path) + Path.GetExtension(source)); + var destination = Path.GetFileName(series.Path) + Path.GetExtension(source); return new List{ new ImageFileResult(destination, source) }; } @@ -220,7 +220,7 @@ public override List SeasonImages(Series series, Season season) } var filename = Path.GetFileName(seasonFolder) + ".jpg"; - var path = Path.Combine(series.Path, seasonFolder, filename); + var path = series.Path.GetRelativePath(Path.Combine(series.Path, seasonFolder, filename)); return new List { new ImageFileResult(path, image.Url) }; }