Browse Source

Fixed output from Search and URL Parsing not being decoded properly.

tags/3.0.1
Teknikode 4 years ago
parent
commit
2c651d6186
2 changed files with 3 additions and 3 deletions
  1. 2
    2
      Modules/Search/Search.cs
  2. 1
    1
      Modules/Url Parsing/Url_Parsing.cs

+ 2
- 2
Modules/Search/Search.cs View File

@@ -45,8 +45,8 @@ namespace Combot.Modules.Plugins
{
var result = parsed["responseData"]["results"][0];
string url = result.Value<string>("unescapedUrl");
string title = HttpUtility.UrlDecode(StripTagsCharArray(result.Value<string>("titleNoFormatting")));
string content = HttpUtility.UrlDecode(StripTagsCharArray(result.Value<string>("content")));
string title = HttpUtility.HtmlDecode(HttpUtility.UrlDecode(StripTagsCharArray(result.Value<string>("titleNoFormatting"))));
string content = HttpUtility.HtmlDecode(HttpUtility.UrlDecode(StripTagsCharArray(result.Value<string>("content"))));
string resultMessage = string.Format("[{0}] \u0002{1}\u000F: {2}.", url, title, content);
SendResponse(command.MessageType, command.Location, command.Nick.Nickname, resultMessage);
}

+ 1
- 1
Modules/Url Parsing/Url_Parsing.cs View File

@@ -55,7 +55,7 @@ namespace Combot.Modules.Plugins
x.Encoding = Encoding.UTF8;
string source = x.DownloadString(urlMatch.ToString());
string title = Regex.Match(source, @"\<title\b[^>]*\>\s*(?<Title>[\s\S]*?)\</title\>", RegexOptions.IgnoreCase).Groups["Title"].Value;
Bot.IRC.SendPrivateMessage(message.Channel, string.Format("[URL] {0} ({1})", HttpUtility.UrlDecode(StripTagsCharArray(title)), url.Host));
Bot.IRC.SendPrivateMessage(message.Channel, string.Format("[URL] {0} ({1})", HttpUtility.HtmlDecode(HttpUtility.UrlDecode(StripTagsCharArray(title))), url.Host));
}
break;
case "image":

Loading…
Cancel
Save