mirror of
https://github.com/bitwarden/server.git
synced 2024-12-26 17:37:36 +01:00
webp support
This commit is contained in:
parent
38abfa6fe8
commit
5cfb43bebf
@ -9,6 +9,7 @@ using Bit.Icons.Models;
|
||||
using AngleSharp.Parser.Html;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Text;
|
||||
|
||||
namespace Bit.Icons.Services
|
||||
{
|
||||
@ -21,6 +22,7 @@ namespace Bit.Icons.Services
|
||||
|
||||
private readonly string _pngMediaType = "image/png";
|
||||
private readonly byte[] _pngHeader = new byte[] { 137, 80, 78, 71 };
|
||||
private readonly byte[] _webpHeader = Encoding.UTF8.GetBytes("RIFF");
|
||||
|
||||
private readonly string _icoMediaType = "image/x-icon";
|
||||
private readonly string _icoAltMediaType = "image/vnd.microsoft.icon";
|
||||
@ -246,7 +248,7 @@ namespace Bit.Icons.Services
|
||||
{
|
||||
format = _icoMediaType;
|
||||
}
|
||||
else if(HeaderMatch(bytes, _pngHeader))
|
||||
else if(HeaderMatch(bytes, _pngHeader) || HeaderMatch(bytes, _webpHeader))
|
||||
{
|
||||
format = _pngMediaType;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user