threads / patch / 24164

patchDo not decode url protocol.

Subject: [PATCH] Do not decode url protocol.

## tl;dr

One message between Jun 22, 2010 and Jun 22, 2010. Diffs are folded; open one to read it.

replies: 0people: 1as markdown or json

Pascal Obry· Jun 22, 2010, 09:22 UTC · lore

When using the protocol git+ssh:// for example we do not want to decode the '+' as a space.

This fixes a regression introduced in 9d2e942.
---
 url.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
Show changes to url.c +9 −0
diff --git a/url.c b/url.c
index cd32b92..ba0c1ac 100644
--- a/url.c
+++ b/url.c
@@ -70,9 +70,18 @@ static int url_decode_char(const char *q)
 static char *url_decode_internal(const char **query, const char *stop_at)
 {
 	const char *q = *query;
+	const char *first_slash;
 	struct strbuf out;

 	strbuf_init(&out, 16);
+
+	/* Skip protocol */
+	first_slash = strchr(*query, '/');
+
+	while (q < first_slash) {
+	  strbuf_addch(&out, *q++);
+	}
+
 	do {
 		unsigned char c = *q;
-- 
1.7.1.524.g6df2f


-- 

--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|              http://www.obry.net
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595

← back to recent threads