1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2026-04-26 22:56:23 -04:00

Use Array.Empty and fix a few multiple enumerations

This commit is contained in:
Stepan Goremykin
2023-03-26 20:40:51 -07:00
committed by GitHub
parent c41aec5f77
commit 11d91faaad
14 changed files with 36 additions and 30 deletions
+3 -1
View File
@@ -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;
@@ -87,7 +88,8 @@ namespace Sonarr.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))