try second char if first is special before defaulting to _
This commit is contained in:
parent
7005f831eb
commit
93709ec1e9
|
@ -36,8 +36,11 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
|
||||||
[TestCase("The Mist", "M\\The Mist")]
|
[TestCase("The Mist", "M\\The Mist")]
|
||||||
[TestCase("A", "A\\A")]
|
[TestCase("A", "A\\A")]
|
||||||
[TestCase("30 Rock", "3\\30 Rock")]
|
[TestCase("30 Rock", "3\\30 Rock")]
|
||||||
[TestCase("The '80s Greatest", "_\\The '80s Greatest")]
|
[TestCase("The '80s Greatest", "8\\The '80s Greatest")]
|
||||||
[TestCase("좀비버스", "좀\\좀비버스")]
|
[TestCase("좀비버스", "좀\\좀비버스")]
|
||||||
|
[TestCase("¡Mucha Lucha!", "M\\¡Mucha Lucha!")]
|
||||||
|
[TestCase(".hack", "H\\hack")]
|
||||||
|
[TestCase("Ütopya", "Ü\\Ütopya")]
|
||||||
|
|
||||||
public void should_get_expected_folder_name_back(string title, string expected)
|
public void should_get_expected_folder_name_back(string title, string expected)
|
||||||
{
|
{
|
||||||
|
|
|
@ -381,9 +381,16 @@ namespace NzbDrone.Core.Organizer
|
||||||
{
|
{
|
||||||
if (char.IsLetterOrDigit(title[0]))
|
if (char.IsLetterOrDigit(title[0]))
|
||||||
{
|
{
|
||||||
return title.Substring(0, 1).FirstCharToUpper();
|
return title.Substring(0, 1).ToUpper();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// try the second character if the first was non alphanumeric
|
||||||
|
if (char.IsLetterOrDigit(title[1]))
|
||||||
|
{
|
||||||
|
return title.Substring(1, 1).ToUpper();
|
||||||
|
}
|
||||||
|
|
||||||
|
// default to "_" if no alphanumeric character can be found in the first 2 positions
|
||||||
return "_";
|
return "_";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue