diff --git a/UmlautAdaptarr/Controllers/CapsController.cs b/UmlautAdaptarr/Controllers/CapsController.cs index 1980670..cc81430 100644 --- a/UmlautAdaptarr/Controllers/CapsController.cs +++ b/UmlautAdaptarr/Controllers/CapsController.cs @@ -18,7 +18,7 @@ namespace UmlautAdaptarr.Controllers [HttpGet] public async Task Caps([FromRoute] string apiKey, [FromRoute] string domain, [FromQuery] string? apikey) { - if (_options.ApiKey != null && !apiKey.Equals(apiKey)) + if (!string.IsNullOrEmpty(apikey) && !apiKey.Equals(apiKey)) { _logger.LogWarning("Invalid or missing API key for request."); return Unauthorized("Unauthorized: Invalid or missing API key."); diff --git a/UmlautAdaptarr/Controllers/SearchController.cs b/UmlautAdaptarr/Controllers/SearchController.cs index 637a64c..9a98daa 100644 --- a/UmlautAdaptarr/Controllers/SearchController.cs +++ b/UmlautAdaptarr/Controllers/SearchController.cs @@ -169,7 +169,7 @@ namespace UmlautAdaptarr.Controllers internal bool AssureApiKey(string apiKey) { - if (options.Value.ApiKey != null && !apiKey.Equals(options.Value.ApiKey)) + if (!string.IsNullOrEmpty(options.Value.ApiKey) && !apiKey.Equals(options.Value.ApiKey)) { logger.LogWarning("Invalid or missing API key for request."); return false;