Skip to content

Commit 17c6330

Browse files
committed
Fixed caching for http iconUrls on Unity2022
1 parent 66b0ede commit 17c6330

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/NuGetForUnity/Editor/Helper/NugetPackageTextureHelper.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,15 @@ internal static Task<Texture2D> DownloadImageAsync([NotNull] string url)
4141
{
4242
try
4343
{
44+
#if UNITY_2022_1_OR_NEWER
45+
if (PlayerSettings.insecureHttpOption == InsecureHttpOption.NotAllowed &&
46+
url.StartsWith("http://", StringComparison.OrdinalIgnoreCase))
47+
{
48+
// if insecure http url is not allowed try to use https.
49+
url = url.Replace("http://", "https://", StringComparison.OrdinalIgnoreCase);
50+
}
51+
#endif
52+
4453
var fromCache = false;
4554
if (url.StartsWith("file://", StringComparison.OrdinalIgnoreCase))
4655
{
@@ -53,15 +62,6 @@ internal static Task<Texture2D> DownloadImageAsync([NotNull] string url)
5362
fromCache = true;
5463
}
5564

56-
#if UNITY_2022_1_OR_NEWER
57-
if (PlayerSettings.insecureHttpOption == InsecureHttpOption.NotAllowed &&
58-
url.StartsWith("http://", StringComparison.OrdinalIgnoreCase))
59-
{
60-
// if insecure http url is not allowed try to use https.
61-
url = url.Replace("http://", "https://", StringComparison.OrdinalIgnoreCase);
62-
}
63-
#endif
64-
6565
var taskCompletionSource = new TaskCompletionSource<Texture2D>();
6666
var request = UnityWebRequest.Get(url);
6767
{

0 commit comments

Comments
 (0)