From 9379658bea314ecae159597912901c576e43e97a Mon Sep 17 00:00:00 2001 From: Shreyas Zare Date: Sat, 18 Jan 2025 13:20:51 +0530 Subject: [PATCH] DropRequests: fixed issue in BlockedQuestion caused due to unknown type causing it to match with all requests. --- Apps/DropRequestsApp/App.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Apps/DropRequestsApp/App.cs b/Apps/DropRequestsApp/App.cs index a5d74d4a..272fdde6 100644 --- a/Apps/DropRequestsApp/App.cs +++ b/Apps/DropRequestsApp/App.cs @@ -153,10 +153,17 @@ namespace DropRequests if (jsonQuestion.TryGetProperty("blockZone", out JsonElement jsonBlockZone)) _blockZone = jsonBlockZone.GetBoolean(); - if (jsonQuestion.TryGetProperty("type", out JsonElement jsonType) && Enum.TryParse(jsonType.GetString(), true, out DnsResourceRecordType type)) + if (jsonQuestion.TryGetProperty("type", out JsonElement jsonType)) + { + if (!Enum.TryParse(jsonType.GetString(), true, out DnsResourceRecordType type)) + throw new NotSupportedException("DNS record type is not supported: " + jsonType.GetString()); + _type = type; + } else + { _type = DnsResourceRecordType.Unknown; + } } #endregion