{"thread":{"id":"18816","subject":"[PATCH] gitweb: Don't append '/' to project base URL if it ends with '/' or ':'","startedAt":"2009-04-09T19:59:21Z","lastAt":"2009-04-09T19:59:21Z","messageCount":1,"participants":["Erik Broes"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"110969","messageId":"49DE5399.60402@ripe.net","threadId":"18816","inReplyTo":null,"subject":"[PATCH] gitweb: Don't append '/' to project base URL if it ends with '/' or ':'","fromName":"Erik Broes","fromEmail":"erikbroes@ripe.net","sentAt":"2009-04-09T19:59:21Z","receivedAt":"2009-04-09T19:59:21Z","isPatch":true,"sender":{"key":"erikbroes@ripe.net","avatar":null},"body":"The base URL 'user@host' would always be appended with a '/', making it\nimpossible to create clone URLs like: user@host:repo. Setting your base\nURL to 'user@host:' will now have the desired effect.\n\nSigned-off-by: Erik Broes <erikbroes@ripe.net>\n---\n gitweb/README      |   13 +++++++------\n gitweb/gitweb.perl |    5 ++++-\n 2 files changed, 11 insertions(+), 7 deletions(-)\n\ndiff --git a/gitweb/README b/gitweb/README\nindex 8433dd1..efb0f1b 100644\n--- a/gitweb/README\n+++ b/gitweb/README\n@@ -69,12 +69,13 @@ You can specify the following configuration variables when building GIT:\n    SERVER_NAME CGI environment variable is not set (e.g. if running\n    gitweb as standalone script).  [No default]\n  * GITWEB_BASE_URL\n-   Git base URLs used for URL to where fetch project from, i.e. full\n-   URL is \"$git_base_url/$project\".  Shown on projects summary page.\n-   Repository URL for project can be also configured per repository; this\n-   takes precedence over URLs composed from base URL and a project name.\n-   Note that you can setup multiple base URLs (for example one for\n-   git:// protocol access, another for http:// access) from the gitweb\n+   Git base URLs used for URL to where fetch project from, i.e. full URL is\n+   \"$git_base_url/$project\".  No '/' will be added between the base URL and and\n+   the project if the base URL ends with either a ':' or '/'.  Shown on\n+   projects summary page.  Repository URL for project can be also configured\n+   per repository; this takes precedence over URLs composed from base URL and a\n+   project name.  Note that you can setup multiple base URLs (for example one\n+   for git:// protocol access, another for http:// access) from the gitweb\n    config file.  [No default]\n  * GITWEB_CSS\n    Points to the location where you put gitweb.css on your web server\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 33ef190..179c48d 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -4503,7 +4503,10 @@ sub git_summary {\n \t# or make project git URL from git base URL and project name\n \tmy $url_tag = \"URL\";\n \tmy @url_list = git_get_project_url_list($project);\n-\t@url_list = map { \"$_/$project\" } @git_base_url_list unless @url_list;\n+\n+\t# Only join with a '/' if there is no trailing '/' or ':'\n+\t@url_list = map { $_ .= '/' unless m{[:/]$}; $_.$project } @git_base_url_list unless @url_list;\n+\n \tforeach my $git_url (@url_list) {\n \t\tnext unless $git_url;\n \t\tprint \"<tr class=\\\"metadata_url\\\"><td>$url_tag</td><td>$git_url</td></tr>\\n\";\n-- \n1.6.2.1.519.gcf01bc\n"}]}