Skip to content

Commit

Permalink
Fixed caching for http iconUrls on Unity2022
Browse files Browse the repository at this point in the history
  • Loading branch information
igor84 committed Dec 22, 2023
1 parent 66b0ede commit 17c6330
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/NuGetForUnity/Editor/Helper/NugetPackageTextureHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@ internal static Task<Texture2D> DownloadImageAsync([NotNull] string url)
{
try
{
#if UNITY_2022_1_OR_NEWER
if (PlayerSettings.insecureHttpOption == InsecureHttpOption.NotAllowed &&
url.StartsWith("http://", StringComparison.OrdinalIgnoreCase))
{
// if insecure http url is not allowed try to use https.
url = url.Replace("http://", "https://", StringComparison.OrdinalIgnoreCase);
}
#endif

var fromCache = false;
if (url.StartsWith("file://", StringComparison.OrdinalIgnoreCase))
{
Expand All @@ -53,15 +62,6 @@ internal static Task<Texture2D> DownloadImageAsync([NotNull] string url)
fromCache = true;
}

#if UNITY_2022_1_OR_NEWER
if (PlayerSettings.insecureHttpOption == InsecureHttpOption.NotAllowed &&
url.StartsWith("http://", StringComparison.OrdinalIgnoreCase))
{
// if insecure http url is not allowed try to use https.
url = url.Replace("http://", "https://", StringComparison.OrdinalIgnoreCase);
}
#endif

var taskCompletionSource = new TaskCompletionSource<Texture2D>();
var request = UnityWebRequest.Get(url);
{
Expand Down

0 comments on commit 17c6330

Please sign in to comment.