Browse Source

update regex to look for "discordapp"

pull/1260/head
Chris Johnston 6 years ago
parent
commit
a8c0ba60d1
2 changed files with 2 additions and 2 deletions
  1. +1
    -1
      src/Discord.Net.Webhook/DiscordWebhookClient.cs
  2. +1
    -1
      test/Discord.Net.Tests/Tests.DiscordWebhookClient.cs

+ 1
- 1
src/Discord.Net.Webhook/DiscordWebhookClient.cs View File

@@ -32,7 +32,7 @@ namespace Discord.Webhook
: this(webhookUrl, new DiscordRestConfig()) { }

// regex pattern to match webhook urls
private static Regex WebhookUrlRegex = new Regex(@"^.+.com\/api\/webhooks\/([\d]+)\/([a-z0-9_-]+)$", RegexOptions.Compiled | RegexOptions.IgnoreCase);
private static Regex WebhookUrlRegex = new Regex(@"^.*discordapp\.com\/api\/webhooks\/([\d]+)\/([a-z0-9_-]+)$", RegexOptions.Compiled | RegexOptions.IgnoreCase);

/// <summary> Creates a new Webhook Discord client. </summary>
public DiscordWebhookClient(ulong webhookId, string webhookToken, DiscordRestConfig config)


+ 1
- 1
test/Discord.Net.Tests/Tests.DiscordWebhookClient.cs View File

@@ -19,7 +19,7 @@ namespace Discord
// don't care about https
[InlineData("http://canary.discordapp.com/api/webhooks/123412347732897802/_abcde123456789-ABCDEFGHIJKLMNOP12345678-abcdefghijklmnopABCDEFGHIJK")]
// this is the minimum that the regex cares about
[InlineData("p.com/api/webhooks/123412347732897802/_abcde123456789-ABCDEFGHIJKLMNOP12345678-abcdefghijklmnopABCDEFGHIJK")]
[InlineData("discordapp.com/api/webhooks/123412347732897802/_abcde123456789-ABCDEFGHIJKLMNOP12345678-abcdefghijklmnopABCDEFGHIJK")]
public void TestWebhook_Valid(string webhookurl)
{
try


Loading…
Cancel
Save