From 0c186988f1353e3d41c18261a737ad75f160847d Mon Sep 17 00:00:00 2001 From: d4n Date: Sat, 2 Mar 2024 21:12:16 -0500 Subject: [PATCH] Add URL checks to reverse image search commands --- src/Modules/ImageModule.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Modules/ImageModule.cs b/src/Modules/ImageModule.cs index 11859f4..7cde77a 100644 --- a/src/Modules/ImageModule.cs +++ b/src/Modules/ImageModule.cs @@ -217,6 +217,11 @@ public async Task ReverseAsync([Summary(description: "The URL of public async Task ReverseAsync(string url, ReverseImageSearchEngine engine, bool multiImages, IDiscordInteraction interaction, IDiscordInteraction? originalInteraction = null, bool ephemeral = false) { + if (!Uri.IsWellFormedUriString(url, UriKind.Absolute)) + { + return FergunResult.FromError(_localizer["UrlNotWellFormed"], true, interaction); + } + _logger.LogDebug("Performing reverse image search (engine: {Engine}, multi-images: {MultiImages}, ephemeral: {Ephemeral})", engine, multiImages, ephemeral); return engine switch