chore(backend): silence some more resharper errors
This commit is contained in:
parent
103ba24555
commit
2cef7523d2
14 changed files with 38 additions and 35 deletions
|
@ -17,7 +17,7 @@ public partial class InternalController(DatabaseContext db) : ControllerBase
|
|||
|
||||
private static string GetCleanedTemplate(string template)
|
||||
{
|
||||
if (template.StartsWith("api/v2")) template = template.Substring("api/v2".Length);
|
||||
if (template.StartsWith("api/v2")) template = template["api/v2".Length..];
|
||||
template = PathVarRegex()
|
||||
.Replace(template, "{id}") // Replace all path variables (almost always IDs) with `{id}`
|
||||
.Replace("@me", "{id}"); // Also replace hardcoded `@me` with `{id}`
|
||||
|
@ -50,7 +50,7 @@ public partial class InternalController(DatabaseContext db) : ControllerBase
|
|||
Snowflake? UserId,
|
||||
string Template);
|
||||
|
||||
private static Endpoint? GetEndpoint(HttpContext httpContext, string url, string requestMethod)
|
||||
private static RouteEndpoint? GetEndpoint(HttpContext httpContext, string url, string requestMethod)
|
||||
{
|
||||
var endpointDataSource = httpContext.RequestServices.GetService<EndpointDataSource>();
|
||||
if (endpointDataSource == null) return null;
|
||||
|
@ -60,7 +60,7 @@ public partial class InternalController(DatabaseContext db) : ControllerBase
|
|||
{
|
||||
if (endpoint.RoutePattern.RawText == null) continue;
|
||||
|
||||
var templateMatcher = new TemplateMatcher(TemplateParser.Parse(endpoint.RoutePattern.RawText), new());
|
||||
var templateMatcher = new TemplateMatcher(TemplateParser.Parse(endpoint.RoutePattern.RawText), new RouteValueDictionary());
|
||||
if (!templateMatcher.TryMatch(url, new())) continue;
|
||||
var httpMethodAttribute = endpoint.Metadata.GetMetadata<HttpMethodAttribute>();
|
||||
if (httpMethodAttribute != null &&
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue