From c0450a5112b437d6f4feeaaf2d334fb2b576fd63 Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Thu, 27 May 2010 10:58:30 +0200 Subject: [PATCH] allow the : to seprate repo name from domain in addresses --- SparkleShare/SparkleDialog.cs | 14 ++++++++++++-- SparkleShare/SparkleHelpers.cs | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/SparkleShare/SparkleDialog.cs b/SparkleShare/SparkleDialog.cs index 2d22495d..39c9e006 100644 --- a/SparkleShare/SparkleDialog.cs +++ b/SparkleShare/SparkleDialog.cs @@ -120,8 +120,18 @@ namespace SparkleShare { public void CloneRepo (object o, EventArgs args) { string RepoRemoteUrl = RemoteUrlCombo.Entry.Text; - string RepoName = - RepoRemoteUrl.Substring (RepoRemoteUrl.LastIndexOf ("/") + 1); + + // Check wheter a "/" or ":" is used to separate the + // repo name from the domain. + + int SlashPos = RepoRemoteUrl.LastIndexOf ("/"); + int ColumnPos = RepoRemoteUrl.LastIndexOf (":"); + + string RepoName; + if (SlashPos > ColumnPos) + RepoName = RepoRemoteUrl.Substring (SlashPos + 1); + else + RepoName = RepoRemoteUrl.Substring (ColumnPos + 1); Process Process = new Process(); Process.EnableRaisingEvents = true; diff --git a/SparkleShare/SparkleHelpers.cs b/SparkleShare/SparkleHelpers.cs index f15b92aa..4f4eda57 100644 --- a/SparkleShare/SparkleHelpers.cs +++ b/SparkleShare/SparkleHelpers.cs @@ -100,7 +100,7 @@ namespace SparkleShare { } public static bool IsGitUrl (string Url) { - return Regex.Match (Url, @"[a-z]+://(.)+/(.)+").Success; + return Regex.Match (Url, @"[a-z]+://(.)+(/|:)(.)+").Success; } }