Skip to content

Commit

Permalink
Prevent multiple enumerations in Custom Formats token
Browse files Browse the repository at this point in the history
  • Loading branch information
mynameisbogdan authored and markus101 committed Apr 9, 2024
1 parent 1aef910 commit 1fcd2b4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/NzbDrone.Core/Organizer/FileNameBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,7 @@ private void AddCustomFormats(Dictionary<string, Func<TokenMatch, string>> token
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;
};
}

Expand All @@ -719,7 +719,7 @@ private void AddIdTokens(Dictionary<string, Func<TokenMatch, string>> tokenHandl

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;

Expand Down

0 comments on commit 1fcd2b4

Please sign in to comment.