Do host name checking the same way in back- and frontend
This commit is contained in:
parent
748a54652f
commit
4d6ea9d707
|
@ -53,7 +53,7 @@ namespace SparkleLib {
|
||||||
|
|
||||||
public string Domain {
|
public string Domain {
|
||||||
get {
|
get {
|
||||||
Regex regex = new Regex (@"(@|://)([a-z0-9\.]+)/");
|
Regex regex = new Regex (@"(@|://)([a-z0-9\.]+)(/|:)");
|
||||||
Match match = regex.Match (Url);
|
Match match = regex.Match (Url);
|
||||||
|
|
||||||
if (match.Success)
|
if (match.Success)
|
||||||
|
|
|
@ -968,12 +968,14 @@ namespace SparkleShare {
|
||||||
{
|
{
|
||||||
SparkleHelpers.DebugInfo ("Controller", "Formed URL: " + url);
|
SparkleHelpers.DebugInfo ("Controller", "Formed URL: " + url);
|
||||||
|
|
||||||
// TODO: GetDomain method
|
string host = GetHost (url);
|
||||||
string host = url.Substring (url.IndexOf ("@") + 1);
|
|
||||||
if (host.Contains (":"))
|
if (String.IsNullOrEmpty (host)) {
|
||||||
host = host.Substring (0, host.IndexOf (":"));
|
if (FolderFetchError != null)
|
||||||
else
|
FolderFetchError ();
|
||||||
host = host.Substring (0, host.IndexOf ("/"));
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
DisableHostKeyCheckingForHost (host);
|
DisableHostKeyCheckingForHost (host);
|
||||||
|
|
||||||
|
@ -1055,6 +1057,18 @@ namespace SparkleShare {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private string GetHost (string url)
|
||||||
|
{
|
||||||
|
Regex regex = new Regex (@"(@|://)([a-z0-9\.]+)(/|:)");
|
||||||
|
Match match = regex.Match (url);
|
||||||
|
|
||||||
|
if (match.Success)
|
||||||
|
return match.Groups [2].Value;
|
||||||
|
else
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Checks whether there are any folders syncing and
|
// Checks whether there are any folders syncing and
|
||||||
// quits if safe
|
// quits if safe
|
||||||
public void TryQuit ()
|
public void TryQuit ()
|
||||||
|
|
Loading…
Reference in a new issue