Prevent multiple enumerations in Custom Formats token

This commit is contained in:
Bogdan 2024-04-09 08:09:12 +03:00 committed by Mark McDowall
parent 1aef91041e
commit 1fcd2b492c
1 changed files with 2 additions and 2 deletions

View File

@ -706,7 +706,7 @@ namespace NzbDrone.Core.Organizer
return string.Empty;
}
return customFormats.Where(x => x.IncludeCustomFormatWhenRenaming && x.Name == m.CustomFormat).FirstOrDefault()?.ToString() ?? string.Empty;
return customFormats.FirstOrDefault(x => x.IncludeCustomFormatWhenRenaming && x.Name == m.CustomFormat)?.ToString() ?? string.Empty;
};
}
@ -719,7 +719,7 @@ namespace NzbDrone.Core.Organizer
private string GetCustomFormatsToken(List<CustomFormat> customFormats, string filter)
{
var tokens = customFormats.Where(x => x.IncludeCustomFormatWhenRenaming);
var tokens = customFormats.Where(x => x.IncludeCustomFormatWhenRenaming).ToList();
var filteredTokens = tokens;