Browse Source

Fixed issue where large files was causing out of memory exception. Issue #31

tags/3.0.5
Teknikode 4 years ago
parent
commit
0e81b88f15
1 changed files with 6 additions and 2 deletions
  1. 6
    2
      Modules/Url Parsing/Url_Parsing.cs

+ 6
- 2
Modules/Url Parsing/Url_Parsing.cs View File

@@ -53,9 +53,9 @@ namespace Combot.Modules.Plugins
{
case "text":
Regex ytRegex = new Regex("(((youtube.*(v=|/v/))|(youtu\\.be/))(?<ID>[-_a-zA-Z0-9]+))");
if (ytRegex.IsMatch(message.Message))
if (ytRegex.IsMatch(urlMatch.ToString()))
{
Match ytMatch = ytRegex.Match(message.Message);
Match ytMatch = ytRegex.Match(urlMatch.ToString());
string youtubeMessage = GetYoutubeDescription(ytMatch.Groups["ID"].Value);
Bot.IRC.Command.SendPrivateMessage(message.Channel, youtubeMessage);
}
@@ -101,6 +101,10 @@ namespace Combot.Modules.Plugins
Bot.IRC.Command.SendPrivateMessage(message.Channel, string.Format("[URL] Response Code: \u0002{0}\u0002 ({1})", code, url.Host));
}
}
catch (OutOfMemoryException ex)
{
Bot.IRC.Command.SendPrivateMessage(message.Channel, string.Format("[URL] Site content was too large ({0})", url.Host));
}
}
}
}

Loading…
Cancel
Save