Skip to content

Commit

Permalink
Nullability fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
lilith committed Feb 27, 2024
1 parent 79fd38a commit 627c34a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/Imazen.Routing/Layers/Licensing.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ public class LicenseOptions{
internal class Licensing : ILicenseConfig, ILicenseChecker, IHasDiagnosticPageSection
{

private readonly Func<Uri>? getCurrentRequestUrl;
private readonly Func<Uri?>? getCurrentRequestUrl;

private readonly LicenseManagerSingleton mgr;

private Computation? cachedResult;
internal Licensing(LicenseManagerSingleton mgr, Func<Uri>? getCurrentRequestUrl = null)
internal Licensing(LicenseManagerSingleton mgr, Func<Uri?>? getCurrentRequestUrl = null)
{
this.mgr = mgr;
this.getCurrentRequestUrl = getCurrentRequestUrl;
Expand Down
6 changes: 3 additions & 3 deletions tests/Imageflow.Server.Tests/IntegrationTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,15 @@ await Assert.ThrowsAsync<InvalidOperationException>(async () =>

using var wrongImageExtension1 = await client.GetAsync("/wrong.webp");
wrongImageExtension1.EnsureSuccessStatusCode();
Assert.Equal("image/png", wrongImageExtension1.Content.Headers.ContentType.MediaType);
Assert.Equal("image/png", wrongImageExtension1.Content.Headers.ContentType?.MediaType);

using var wrongImageExtension2 = await client.GetAsync("/wrong.jpg");
wrongImageExtension2.EnsureSuccessStatusCode();
Assert.Equal("image/png", wrongImageExtension2.Content.Headers.ContentType.MediaType);
Assert.Equal("image/png", wrongImageExtension2.Content.Headers.ContentType?.MediaType);

using var extensionlessRequest = await client.GetAsync("/extensionless/file");
extensionlessRequest.EnsureSuccessStatusCode();
Assert.Equal("image/png", extensionlessRequest.Content.Headers.ContentType.MediaType);
Assert.Equal("image/png", extensionlessRequest.Content.Headers.ContentType?.MediaType);


using var response2 = await client.GetAsync("/fire.jpg?width=1");
Expand Down
2 changes: 1 addition & 1 deletion tests/Imageflow.Server.Tests/TempContentRoot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public TempContentRoot AddResource(string relativePath, string resourceName)
using var reader = embeddedProvider.GetFileInfo(resourceName).CreateReadStream();
var newFilePath = Path.Combine(PhysicalPath, relativePath.Replace('/', Path.DirectorySeparatorChar));
var parentDir = Path.GetDirectoryName(newFilePath);
if (!Directory.Exists(parentDir))
if (parentDir != null && !Directory.Exists(parentDir))
Directory.CreateDirectory(parentDir);
using var newFile = File.Create(newFilePath);
reader.CopyTo(newFile);
Expand Down
4 changes: 2 additions & 2 deletions tests/Imageflow.Server.Tests/TestLicensing.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ namespace Imageflow.Server.Tests
{
class RequestUrlProvider
{
public Uri Url { get; set; } = null;
public Uri Get() => Url;
public Uri? Url { get; set; }
public Uri? Get() => Url;
}

public class TestLicensing
Expand Down

0 comments on commit 627c34a

Please sign in to comment.