mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
Improve URI validation beyond just scheme validation
This commit is contained in:
parent
e518cf6e32
commit
6cee8ebe1a
1 changed files with 14 additions and 2 deletions
|
|
@ -269,8 +269,20 @@ internal class ThirdRepoSettingsEntry : SettingsEntry
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool ValidThirdPartyRepoUrl(string url)
|
private static bool ValidThirdPartyRepoUrl(string url)
|
||||||
=> Uri.TryCreate(url, UriKind.Absolute, out var uriResult)
|
{
|
||||||
&& (uriResult.Scheme == Uri.UriSchemeHttps || uriResult.Scheme == Uri.UriSchemeHttp);
|
if (!Uri.TryCreate(url, UriKind.Absolute, out var uriResult))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (uriResult.Scheme != Uri.UriSchemeHttps && uriResult.Scheme != Uri.UriSchemeHttp)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (string.IsNullOrWhiteSpace(uriResult.Host))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
var hostNameType = Uri.CheckHostName(uriResult.Host);
|
||||||
|
return hostNameType != UriHostNameType.Unknown
|
||||||
|
&& Uri.IsWellFormedUriString(url, UriKind.Absolute);
|
||||||
|
}
|
||||||
|
|
||||||
private bool ValidateTempRepoInput()
|
private bool ValidateTempRepoInput()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue