Browse Source

Fix url validation

pull/1923/head
quin lynch 3 years ago
parent
commit
9a7e925030
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      src/Discord.Net.Core/Utils/UrlValidation.cs

+ 1
- 1
src/Discord.Net.Core/Utils/UrlValidation.cs View File

@@ -16,7 +16,7 @@ namespace Discord.Utils
{ {
if (string.IsNullOrEmpty(url)) if (string.IsNullOrEmpty(url))
return false; return false;
if (!(url.StartsWith("http://", StringComparison.OrdinalIgnoreCase) || url.StartsWith("https://", StringComparison.OrdinalIgnoreCase) || allowAttachments ? url.StartsWith("attachment://", StringComparison.Ordinal) : false))
if (!(url.StartsWith("http://", StringComparison.OrdinalIgnoreCase) || url.StartsWith("https://", StringComparison.OrdinalIgnoreCase) || (allowAttachments ? url.StartsWith("attachment://", StringComparison.Ordinal) : false)))
throw new InvalidOperationException($"The url {url} must include a protocol (either {(allowAttachments ? "HTTP, HTTPS, or ATTACHMENT" : "HTTP or HTTPS")})"); throw new InvalidOperationException($"The url {url} must include a protocol (either {(allowAttachments ? "HTTP, HTTPS, or ATTACHMENT" : "HTTP or HTTPS")})");
return true; return true;
} }


Loading…
Cancel
Save