mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-11-15 18:08:53 -07:00
Remove unnecessary array allocation
Co-authored-by: Claus Vium <cvium@users.noreply.github.com>
This commit is contained in:
parent
54549cd5b5
commit
60fe77c089
@ -210,15 +210,12 @@ namespace Jellyfin.Api.Controllers
|
||||
if (item is IHasTrailers hasTrailers)
|
||||
{
|
||||
var trailers = hasTrailers.LocalTrailers;
|
||||
var dtosTrailers = _dtoService.GetBaseItemDtos(trailers, dtoOptions, user, item);
|
||||
var allTrailers = new BaseItemDto[dtosTrailers.Count];
|
||||
dtosTrailers.CopyTo(allTrailers, 0);
|
||||
return allTrailers;
|
||||
return Ok(_dtoService.GetBaseItemDtos(trailers, dtoOptions, user, item));
|
||||
}
|
||||
|
||||
return item.GetExtras(new[] { ExtraType.Trailer })
|
||||
.Select(i => _dtoService.GetBaseItemDto(i, dtoOptions, user, item))
|
||||
.ToArray();
|
||||
return Ok(item.GetExtras()
|
||||
.Where(e => e.ExtraType == ExtraType.Trailer)
|
||||
.Select(i => _dtoService.GetBaseItemDto(i, dtoOptions, user, item)));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
Loading…
Reference in New Issue
Block a user