1
0
mirror of https://github.com/imgproxy/imgproxy.git synced 2025-09-16 09:36:18 +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

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}";
}
}