Skip to content

Commit

Permalink
Automated dotnet-format update
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Jul 2, 2024
1 parent 1d8fc12 commit a885b48
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public static bool TryParseUrl(string urlRaw, out TType articleId)

if (url.LocalPath.Split('/', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries) is not [_, var articles, var articleIdRaw, ..])
return false;

if (!string.Equals(articles, "articles", StringComparison.OrdinalIgnoreCase))
return false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public static bool TryParseUrl(string? urlRaw, out TType modId)

if (url.LocalPath.Split('/', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries) is not [_, var mods, var modIdRaw, ..])
return false;

if (!string.Equals(mods, "mods", StringComparison.OrdinalIgnoreCase))
return false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public static bool TryParseUrl(string urlRaw, out TType userId)

if (!string.Equals(users, "users", StringComparison.OrdinalIgnoreCase))
return false;

return TryParse(userIdRaw, out userId);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.AspNetCore.Mvc.Routing;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;

using System;
Expand All @@ -17,8 +19,6 @@
using System.Text.Json;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.Routing;
using Microsoft.Extensions.Logging;

namespace BUTR.Site.NexusMods.Server.Controllers;

Expand Down Expand Up @@ -112,11 +112,11 @@ protected ApiResult ApiResultError(string error, int statusCode)
{
var routeAttribute = Url.ActionContext.ActionDescriptor.EndpointMetadata.OfType<HttpMethodAttribute>().First();
var routeTemplate = routeAttribute.Template;

var loggerFactory = HttpContext.RequestServices.GetRequiredService<ILoggerFactory>();
var logger = loggerFactory.CreateLogger(GetType());
logger.LogError("Route: {Route}, API Error: {Error}", routeTemplate, error);

if (statusCode is < 400 or >= 600)
throw new ArgumentOutOfRangeException(nameof(statusCode));

Expand Down
4 changes: 2 additions & 2 deletions src/BUTR.Site.NexusMods.Shared/Helpers/NexusModsUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public static bool TryParseModUrl(string? url, [NotNullWhen(true)] out string? g
var split = str1[1].Split('/', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries);
if (split.Length != 3)
return false;

if (!string.Equals(split[1], "mods", StringComparison.OrdinalIgnoreCase))
return false;

Expand Down Expand Up @@ -56,7 +56,7 @@ public static bool TryParseUserId(string? url, [NotNullWhen(true)] out string? g

if (!string.Equals(split[1], "users", StringComparison.OrdinalIgnoreCase))
return false;

if (!uint.TryParse(split[2], out var userIdNumber))
return false;

Expand Down

0 comments on commit a885b48

Please sign in to comment.