Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use URI instead of string to download package icons #680

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/NuGetForUnity/Editor/Helper/NugetPackageTextureHelper.cs
Original file line number Diff line number Diff line change
@@ -64,7 +64,7 @@ internal static Task<Texture2D> DownloadImageAsync([NotNull] string url)
}

var taskCompletionSource = new TaskCompletionSource<Texture2D>();
var request = UnityWebRequest.Get(url);
var request = UnityWebRequest.Get(new Uri(url, UriKind.Absolute));
{
var downloadHandler = new DownloadHandlerTexture(false);

@@ -133,7 +133,7 @@ private static string GetFilePath([NotNull] string url)
return Path.Combine(Application.temporaryCachePath, GetHash(url));
}

[SuppressMessage("Design", "CA5351", Justification = "Only use MD5 hash as cache key / not securty relevant.")]
[SuppressMessage("Design", "CA5351", Justification = "Only use MD5 hash as cache key / not security relevant.")]
[NotNull]
private static string GetHash([NotNull] string s)
{
@@ -145,7 +145,7 @@ private static string GetHash([NotNull] string s)
using (var md5 = new MD5CryptoServiceProvider())
{
var data = md5.ComputeHash(Encoding.Default.GetBytes(s));
return Convert.ToBase64String(data).Replace('+', '-').Replace('/', '_').Replace("=", null);
return Convert.ToBase64String(data).Replace('+', '-').Replace('/', '_').TrimEnd('=');
}
}
}