From 2a8ea034b63736708839c140e53121026c19b9a8 Mon Sep 17 00:00:00 2001
From: James Moger <james.moger@gitblit.com>
Date: Thu, 19 Sep 2013 09:03:04 -0400
Subject: [PATCH] Fix support for implied SSH urls in web.otherUrls (issue-311)

---
 releases.moxie                                                  |    3 +++
 src/main/java/com/gitblit/wicket/panels/RepositoryUrlPanel.java |   10 +++++++++-
 2 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/releases.moxie b/releases.moxie
index b05fbc1..23c0de8 100644
--- a/releases.moxie
+++ b/releases.moxie
@@ -10,6 +10,7 @@
     text: ~
     security: ~
     fixes:
+	- Fixed support for implied SSH urls in web.otherUrls (issue-311)
 	- Fix potential NPE on removing uncached repository from cache
 	- Ignore the default contents of .git/description file
     changes:
@@ -32,6 +33,8 @@
 	- Klaus Nuber
 	- Florian Zschocke
 	- Bret Ikehara
+	- Chad Horohoe
+	- Domingo Oropeza
 }
 
 #
diff --git a/src/main/java/com/gitblit/wicket/panels/RepositoryUrlPanel.java b/src/main/java/com/gitblit/wicket/panels/RepositoryUrlPanel.java
index aaab2b1..0dae3cf 100644
--- a/src/main/java/com/gitblit/wicket/panels/RepositoryUrlPanel.java
+++ b/src/main/java/com/gitblit/wicket/panels/RepositoryUrlPanel.java
@@ -365,7 +365,15 @@
 		if (!urlPermissionsMap.containsKey(repoUrl.url)) {
 			String note;
 			if (repoUrl.isExternal()) {
-				String protocol = repoUrl.url.substring(0, repoUrl.url.indexOf("://"));
+				String protocol;
+				int protocolIndex = repoUrl.url.indexOf("://");
+				if (protocolIndex > -1) {
+					// explicit protocol specified
+					protocol = repoUrl.url.substring(0, protocolIndex);
+				} else {
+					// implicit SSH url
+					protocol = "ssh";
+				}
 				note = MessageFormat.format(getString("gb.externalPermissions"), protocol);			
 			} else {
 				note = null;			

--
Gitblit v1.9.1