From 742d8eed11a3ddc4175f95ba092b68dd003ddfac Mon Sep 17 00:00:00 2001 From: Gervasio Marchand Date: Thu, 12 Jan 2023 16:18:54 -0300 Subject: [PATCH] tweaks --- src/FakeRelay.Web/Controllers/ApiController.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/FakeRelay.Web/Controllers/ApiController.cs b/src/FakeRelay.Web/Controllers/ApiController.cs index 850560c..35105c4 100644 --- a/src/FakeRelay.Web/Controllers/ApiController.cs +++ b/src/FakeRelay.Web/Controllers/ApiController.cs @@ -59,12 +59,12 @@ public class ApiController : Controller [Route("index-posts-count")] public async Task IndexedPostsCount(string period) { - if (Config.Instance.GrafanaHost.IsNullOrEmpty() || Config.Instance.GrafanaKey.IsNullOrEmpty()) + if (Config.Instance.GrafanaHost.IsNullOrEmpty() || Config.Instance.GrafanaKey.IsNullOrEmpty() || !Config.Instance.GrafanaDataSourceId.HasValue) { return NotFound(); } - if (!Regex.IsMatch(period, "^[0-9]+[mhd]$")) + if (period.IsNullOrEmpty() || !Regex.IsMatch(period, "^[0-9]+[mhd]$")) { return BadRequest(); }