@matheusbsbs / matheus-bagliano / commits / 3c73a1d57f
Fork 0

url_decode: URL scheme ends with a colon and does not require a slash

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Junio C Hamano committed Jun 24, 2010 at 13:36 UTC 3c73a1d57f9319dbbaf882835608ad421c8b9600
1 file changed +4 -4
url.c
+4 -4
@@ -103,12 +103,12 @@ static char *url_decode_internal(const char **query, const char *stop_at, struct
103 char *url_decode(const char *url)
104 {
105 struct strbuf out = STRBUF_INIT;
106 - const char *slash = strchr(url, '/');
106 + const char *colon = strchr(url, ':');
107
108 /* Skip protocol part if present */
109 - if (slash && url < slash) {
110 - strbuf_add(&out, url, slash - url);
111 - url = slash;
109 + if (colon && url < colon) {
110 + strbuf_add(&out, url, colon - url);
111 + url = colon;
112 }
113 return url_decode_internal(&url, NULL, &out);
114 }