diff --git a/AngelLoader/Core.cs b/AngelLoader/Core.cs index bd2462344..7124329d4 100644 --- a/AngelLoader/Core.cs +++ b/AngelLoader/Core.cs @@ -1338,14 +1338,14 @@ internal static void OpenWebSearchUrl(string fmTitle) string url = Config.WebSearchUrl; if (url.IsWhiteSpace() || url.Length > 32766) return; - url = Uri.EscapeUriString(url); - - int index = url.IndexOf("$TITLE$", StringComparison.OrdinalIgnoreCase); - // Possible exceptions are: // ArgumentNullException (stringToEscape is null) // UriFormatException (The length of stringToEscape exceeds 32766 characters) // Those are both checked for above so we're good. + url = Uri.EscapeUriString(url); + + int index = url.IndexOf("$TITLE$", StringComparison.OrdinalIgnoreCase); + string finalUrl = index == -1 ? url : url.Substring(0, index) + Uri.EscapeDataString(fmTitle) + url.Substring(index + "$TITLE$".Length);