Skip to content

Commit 6670e04

Browse files
Simplify GetBySupportedCommands
1 parent d64e430 commit 6670e04

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/ImageSharp.Web/Processors/WebProcessingExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public static FormattedImage Process(
5555
/// </returns>
5656
public static IEnumerable<IImageWebProcessor> GetBySupportedCommands(this IEnumerable<IImageWebProcessor> processors, List<string> commands)
5757
=> processors
58-
.GroupBy(p => commands.Intersect(p.Commands, StringComparer.OrdinalIgnoreCase).Min(c => (int?)commands.FindIndex(k => k.Equals(c, StringComparison.OrdinalIgnoreCase))) ?? -1) // Get index of first supported command
58+
.GroupBy(p => commands.FindIndex(c => p.Commands.Contains(c, StringComparer.OrdinalIgnoreCase))) // Get index of first supported command
5959
.Where(g => g.Key != -1) // Filter processors without supported commands
6060
.OrderBy(g => g.Key) // Order processors by first supported command
6161
.SelectMany(g => g);

0 commit comments

Comments
 (0)