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

icon service fixes

This commit is contained in:
Kyle Spearrin 2018-06-25 09:28:54 -04:00
parent 5c17f910fe
commit 9561b167f7

View File

@ -139,9 +139,10 @@ namespace Bit.Icons.Services
foreach(var icon in icons)
{
Uri iconUri = null;
if(icon.Path.StartsWith("//"))
if(icon.Path.StartsWith("//") && Uri.TryCreate($"{GetScheme(uri)}://{icon.Path.Substring(2)}",
UriKind.Absolute, out var slashUri))
{
iconUri = new Uri($"{GetScheme(uri)}://{icon.Path.Substring(2)}");
iconUri = slashUri;
}
else if(Uri.TryCreate(icon.Path, UriKind.Relative, out var relUri))
{
@ -282,7 +283,18 @@ namespace Bit.Icons.Services
Uri location = null;
if(response.Headers.Location.IsAbsoluteUri)
{
location = response.Headers.Location;
if(response.Headers.Location.Scheme != "http" && response.Headers.Location.Scheme != "https")
{
if(Uri.TryCreate($"https://{response.Headers.Location.OriginalString}",
UriKind.Absolute, out var newUri))
{
location = newUri;
}
}
else
{
location = response.Headers.Location;
}
}
else
{