1
0
mirror of https://github.com/bitwarden/server.git synced 2025-05-07 20:52:21 -05:00

no need to check image header

This commit is contained in:
Kyle Spearrin 2018-03-03 13:50:50 -05:00
parent 9da30669af
commit cf2183471c

View File

@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
@ -19,15 +18,6 @@ namespace Bit.Icons.Controllers
AllowAutoRedirect = false,
AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate
});
static readonly List<byte[]> _validImageData = new List<byte[]>
{
// png
new byte[] { 137, 80, 78, 71 },
// ico
new byte[] { 00, 00, 01, 00 },
// jpeg
new byte[] { 255, 216, 255 }
};
private readonly IMemoryCache _memoryCache;
private readonly IDomainMappingService _domainMappingService;
private readonly IconsSettings _iconsSettings;
@ -70,11 +60,6 @@ namespace Bit.Icons.Controllers
}
var image = await response.Content.ReadAsByteArrayAsync();
if(!_validImageData.Any(d => d.SequenceEqual(image.Take(d.Length))))
{
return new NotFoundResult();
}
icon = new Icon
{
Image = image,