From abf360db3ae2114f96de260f0174a2be9b926ea1 Mon Sep 17 00:00:00 2001 From: Luzifix Date: Sun, 18 Feb 2024 02:34:55 +0100 Subject: [PATCH] Add fallbacks for dbc endpoints --- Controllers/DBC/DataController.cs | 4 ++++ Controllers/DBC/FindController.cs | 4 ++++ Controllers/DBC/HeaderController.cs | 6 ++++-- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Controllers/DBC/DataController.cs b/Controllers/DBC/DataController.cs index e357e41..918cc95 100644 --- a/Controllers/DBC/DataController.cs +++ b/Controllers/DBC/DataController.cs @@ -32,6 +32,10 @@ public string Get() [HttpGet("{name}"), HttpPost("{name}")] public async Task Get(string name, string build, int draw, int start, int length, CancellationToken cancellationToken, bool useHotfixes = false, LocaleFlags locale = LocaleFlags.All_WoW) { + name = name.ToLower(); + if (string.IsNullOrEmpty(build) || build == "?" || build == "null") + build = CASC.BuildName; + var parameters = new Dictionary(); if (Request.Method == "POST") diff --git a/Controllers/DBC/FindController.cs b/Controllers/DBC/FindController.cs index c638aba..95de12c 100644 --- a/Controllers/DBC/FindController.cs +++ b/Controllers/DBC/FindController.cs @@ -96,6 +96,10 @@ public async Task>> Get(string name, string valu [HttpGet("{name}")] public async Task>> Get(string name, string build, string col, int val, bool useHotfixes = false, bool calcOffset = true) { + name = name.ToLower(); + if (string.IsNullOrEmpty(build) || build == "?" || build == "null") + build = CASC.BuildName; + Console.WriteLine("Finding results for " + name + "::" + col + " (" + build + ", hotfixes: " + useHotfixes + ") value " + val); var storage = await dbcManager.GetOrLoad(name, build, useHotfixes); diff --git a/Controllers/DBC/HeaderController.cs b/Controllers/DBC/HeaderController.cs index 2c5ddac..1f152d3 100644 --- a/Controllers/DBC/HeaderController.cs +++ b/Controllers/DBC/HeaderController.cs @@ -41,10 +41,12 @@ public string Get() [HttpGet("{name}")] public async Task Get(string name, string build) { - Console.WriteLine("Serving headers for " + name + " (" + build + ")"); - if (build == "?") + name = name.ToLower(); + if (string.IsNullOrEmpty(build) || build == "?" || build == "null") build = CASC.BuildName; + Console.WriteLine("Serving headers for " + name + " (" + build + ")"); + var result = new HeaderResult(); try {