Don't require trailing slash for clone/push urls
--- a/config/gitphp.conf.defaults.php
+++ b/config/gitphp.conf.defaults.php
@@ -78,7 +78,6 @@
* http://server.com/
* ssh://server.com/git/
* git://server.com/gitprojects/
- * (don't forget trailing slash)
*
* If left blank/commented, no clone url will display.
*/
--- a/include/git/Project.class.php
+++ b/include/git/Project.class.php
@@ -412,8 +412,13 @@
return $this->cloneUrl;
$cloneurl = GitPHP_Config::GetInstance()->GetValue('cloneurl', '');
- if (!empty($cloneurl))
+ if (!empty($cloneurl)) {
+ if (substr($cloneurl, -1) != '/') {
+ $cloneurl .= '/';
+ }
$cloneurl .= $this->project;
+ }
+
return $cloneurl;
}
@@ -444,8 +449,12 @@
return $this->pushUrl;
$pushurl = GitPHP_Config::GetInstance()->GetValue('pushurl', '');
- if (!empty($pushurl))
+ if (!empty($pushurl)) {
+ if (substr($pushurl, -1) != '/') {
+ $pushurl .= '/';
+ }
$pushurl .= $this->project;
+ }
return $pushurl;
}