1
0
mirror of https://github.com/imgproxy/imgproxy.git synced 2025-02-02 11:34:20 +02:00

Use a URL-safe Base64 string (#499)

This commit is contained in:
Galdin Raphael 2020-11-20 10:13:06 +05:30 committed by GitHub
parent 776dfaa420
commit c159027dae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -38,8 +38,8 @@ namespace ImgProxy.Examples
using (var hmac = new HMACSHA256(keybin))
{
var hash = hmac.ComputeHash(saltBin.Concat(Encoding.UTF8.GetBytes(path)).ToArray());
return $"/{Convert.ToBase64String(hash).TrimEnd('=')}{path}";
var urlSafeBase64 = Convert.ToBase64String(hash).TrimEnd('=').Replace('+', '-').Replace('/', '_');
return $"/{urlSafeBase64}{path}";
}
}