mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-12-31 18:20:09 +01:00
Fixed: Use Array.Empty and fix a few multiple enumerations
(cherry picked from commit 11d91faaada0e70910c832ce405ddeed52a24172)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using FluentValidation;
|
||||
using FluentValidation.Results;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
@@ -73,7 +74,8 @@ namespace Prowlarr.Http.REST
|
||||
}
|
||||
}
|
||||
|
||||
var attributes = descriptor.MethodInfo.CustomAttributes;
|
||||
var attributes = descriptor.MethodInfo.CustomAttributes as IReadOnlyCollection<CustomAttributeData> ??
|
||||
descriptor.MethodInfo.CustomAttributes.ToArray();
|
||||
if (attributes.Any(x => VALIDATE_ID_ATTRIBUTES.Contains(x.AttributeType)) && !skipValidate)
|
||||
{
|
||||
if (context.ActionArguments.TryGetValue("id", out var idObj))
|
||||
|
||||
Reference in New Issue
Block a user