Code

url_decode: URL scheme ends with a colon and does not require a slash
authorJunio C Hamano <gitster@pobox.com>
Thu, 24 Jun 2010 20:36:30 +0000 (13:36 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 24 Jun 2010 20:36:30 +0000 (13:36 -0700)
Signed-off-by: Junio C Hamano <gitster@pobox.com>
url.c

diff --git a/url.c b/url.c
index bf5bb9c88f751be2dd22bc49bcd9d53812cc5b94..230623657a0e06975c4721a9fddb117ba84883b1 100644 (file)
--- a/url.c
+++ b/url.c
@@ -103,12 +103,12 @@ static char *url_decode_internal(const char **query, const char *stop_at, struct
 char *url_decode(const char *url)
 {
        struct strbuf out = STRBUF_INIT;
-       const char *slash = strchr(url, '/');
+       const char *colon = strchr(url, ':');
 
        /* Skip protocol part if present */
-       if (slash && url < slash) {
-               strbuf_add(&out, url, slash - url);
-               url = slash;
+       if (colon && url < colon) {
+               strbuf_add(&out, url, colon - url);
+               url = colon;
        }
        return url_decode_internal(&url, NULL, &out);
 }