Skip to content

Commit 3fde177

Browse files
Use lower invariant again
1 parent 026b776 commit 3fde177

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/ImageSharp.Web/Middleware/ImageSharpMiddlewareOptions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public class ImageSharpMiddlewareOptions
1919
private Func<ImageCommandContext, byte[], Task<string>> onComputeHMACAsync = (context, secret) =>
2020
{
2121
string uri = CaseHandlingUriBuilder.BuildRelative(
22-
CaseHandlingUriBuilder.CaseHandling.None,
22+
CaseHandlingUriBuilder.CaseHandling.LowerInvariant,
2323
context.Context.Request.PathBase,
2424
context.Context.Request.Path,
2525
QueryString.Create(context.Commands));
@@ -85,7 +85,7 @@ public class ImageSharpMiddlewareOptions
8585

8686
/// <summary>
8787
/// Gets or sets the method used to compute a Hash-based Message Authentication Code (HMAC) for request authentication.
88-
/// Defaults to <see cref="HMACUtilities.ComputeHMACSHA256(string, byte[])"/> using a relative Uri
88+
/// Defaults to <see cref="HMACUtilities.ComputeHMACSHA256(string, byte[])"/> using an invariant lowercase relative Uri
8989
/// generated using <see cref="CaseHandlingUriBuilder.BuildRelative(CaseHandlingUriBuilder.CaseHandling, PathString, PathString, QueryString)"/>.
9090
/// </summary>
9191
public Func<ImageCommandContext, byte[], Task<string>> OnComputeHMACAsync

tests/ImageSharp.Web.Tests/TestUtilities/AuthenticatedServerTestBase.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ public async Task CanRejectUnauthorizedRequestAsync()
3737

3838
protected override string AugmentCommand(string command)
3939
{
40-
// Mimic the case sensitive url format used by the token and default options.
41-
string uri = (this.ImageSource + command).Replace("http://localhost", string.Empty);
40+
// Mimic the lowecase relative url format used by the token and default options.
41+
string uri = (this.ImageSource + command).Replace("http://localhost", string.Empty).ToLowerInvariant();
4242
string token = HMACUtilities.ComputeHMACSHA256(uri, AuthenticatedTestServerFixture.HMACSecretKey);
4343
return command + "&" + HMACUtilities.TokenCommand + "=" + token;
4444
}

0 commit comments

Comments
 (0)