mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-20 13:33:34 -07:00
Fixed: Trim all leading dots from nested folders (#2371)
This commit is contained in:
parent
07aad3250a
commit
10cb9c344e
2 changed files with 9 additions and 9 deletions
|
@ -29,11 +29,11 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
|
||||||
{
|
{
|
||||||
_artist = Builder<Artist>
|
_artist = Builder<Artist>
|
||||||
.CreateNew()
|
.CreateNew()
|
||||||
.With(s => s.Name = "Linkin Park")
|
.With(s => s.Name = "Metallica")
|
||||||
.With(s => s.Metadata = new ArtistMetadata
|
.With(s => s.Metadata = new ArtistMetadata
|
||||||
{
|
{
|
||||||
Disambiguation = "US Rock Band",
|
Disambiguation = "US Metal Band",
|
||||||
Name = "Linkin Park"
|
Name = "Metallica"
|
||||||
})
|
})
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
|
||||||
|
|
||||||
_album = Builder<Album>
|
_album = Builder<Album>
|
||||||
.CreateNew()
|
.CreateNew()
|
||||||
.With(s => s.Title = "Hybrid Theory")
|
.With(s => s.Title = "...And Justice For All")
|
||||||
.With(s => s.ReleaseDate = new DateTime(2020, 1, 15))
|
.With(s => s.ReleaseDate = new DateTime(2020, 1, 15))
|
||||||
.With(s => s.AlbumType = "Album")
|
.With(s => s.AlbumType = "Album")
|
||||||
.With(s => s.Disambiguation = "The Best Album")
|
.With(s => s.Disambiguation = "The Best Album")
|
||||||
|
@ -97,7 +97,7 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
|
||||||
_namingConfig.StandardTrackFormat = "{Album Title} {(Release Year)}/{Artist Name} - {track:00} [{Quality Title}] {[Quality Proper]}";
|
_namingConfig.StandardTrackFormat = "{Album Title} {(Release Year)}/{Artist Name} - {track:00} [{Quality Title}] {[Quality Proper]}";
|
||||||
|
|
||||||
Subject.BuildTrackFileName(new List<Track> { _track1 }, _artist, _album, _trackFile)
|
Subject.BuildTrackFileName(new List<Track> { _track1 }, _artist, _album, _trackFile)
|
||||||
.Should().Be("Hybrid Theory (2020)\\Linkin Park - 06 [MP3-256]".AsOsAgnostic());
|
.Should().Be("And Justice For All (2020)\\Metallica - 06 [MP3-256]".AsOsAgnostic());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
@ -106,7 +106,7 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
|
||||||
_namingConfig.StandardTrackFormat = "{Album Title} {(Release Year)}\\{Artist Name} - {track:00} [{Quality Title}] {[Quality Proper]}";
|
_namingConfig.StandardTrackFormat = "{Album Title} {(Release Year)}\\{Artist Name} - {track:00} [{Quality Title}] {[Quality Proper]}";
|
||||||
|
|
||||||
Subject.BuildTrackFileName(new List<Track> { _track1 }, _artist, _album, _trackFile)
|
Subject.BuildTrackFileName(new List<Track> { _track1 }, _artist, _album, _trackFile)
|
||||||
.Should().Be("Hybrid Theory (2020)\\Linkin Park - 06 [MP3-256]".AsOsAgnostic());
|
.Should().Be("And Justice For All (2020)\\Metallica - 06 [MP3-256]".AsOsAgnostic());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
@ -117,7 +117,7 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
|
||||||
_release.Media.Add(_medium2);
|
_release.Media.Add(_medium2);
|
||||||
|
|
||||||
Subject.BuildTrackFileName(new List<Track> { _track1 }, _artist, _album, _trackFile)
|
Subject.BuildTrackFileName(new List<Track> { _track1 }, _artist, _album, _trackFile)
|
||||||
.Should().Be("Hybrid Theory (2020)\\CD 03\\Linkin Park - 06 [MP3-256]".AsOsAgnostic());
|
.Should().Be("And Justice For All (2020)\\CD 03\\Metallica - 06 [MP3-256]".AsOsAgnostic());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
@ -128,7 +128,7 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
|
||||||
_release.Media.Add(_medium2);
|
_release.Media.Add(_medium2);
|
||||||
|
|
||||||
Subject.BuildTrackFileName(new List<Track> { _track1 }, _artist, _album, _trackFile)
|
Subject.BuildTrackFileName(new List<Track> { _track1 }, _artist, _album, _trackFile)
|
||||||
.Should().Be("Hybrid Theory (2020)\\CD 03\\Linkin Park - 06 [MP3-256]".AsOsAgnostic());
|
.Should().Be("And Justice For All (2020)\\CD 03\\Metallica - 06 [MP3-256]".AsOsAgnostic());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -131,7 +131,7 @@ namespace NzbDrone.Core.Organizer
|
||||||
|
|
||||||
var component = ReplaceTokens(splitPattern, tokenHandlers, namingConfig).Trim();
|
var component = ReplaceTokens(splitPattern, tokenHandlers, namingConfig).Trim();
|
||||||
|
|
||||||
component = FileNameCleanupRegex.Replace(component, match => match.Captures[0].Value[0].ToString());
|
component = CleanFolderName(component);
|
||||||
component = TrimSeparatorsRegex.Replace(component, string.Empty);
|
component = TrimSeparatorsRegex.Replace(component, string.Empty);
|
||||||
|
|
||||||
if (component.IsNotNullOrWhiteSpace())
|
if (component.IsNotNullOrWhiteSpace())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue