path: root/http.c
diff options
authorTay Ray Chuan <>2009-08-17 09:09:43 (GMT)
committerJunio C Hamano <>2009-08-18 20:59:44 (GMT)
commit800324c3addbf60b15114c4292204806b1300060 (patch)
tree935300efecb4db254a304128d69955dfe76c01e7 /http.c
parent13354f5377d82baee4d8c930df824c8dbeda396d (diff)
http.c: don't assume that urls don't end with slash
Make append_remote_object_url() (and by implication, get_remote_object_url) use end_url_with_slash() to ensure that the url ends with a slash. Previously, they assumed that the url did not end with a slash and as a result appended a slash, sometimes errorneously. This fixes an issue introduced in 5424bc5 ("http*: add helper methods for fetching objects (loose)"), where the append_remote_object_url() implementation in http-push.c, which assumed that urls end with a slash, was replaced by another one in http.c, which assumed urls did not end with a slash. The above issue was raised by Thomas Schlichter: Signed-off-by: Tay Ray Chuan <> Tested-by: Thomas Schlichter <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'http.c')
1 files changed, 3 insertions, 1 deletions
diff --git a/http.c b/http.c
index a2720d5..6182640 100644
--- a/http.c
+++ b/http.c
@@ -719,7 +719,9 @@ void append_remote_object_url(struct strbuf *buf, const char *url,
const char *hex,
int only_two_digit_prefix)
- strbuf_addf(buf, "%s/objects/%.*s/", url, 2, hex);
+ end_url_with_slash(buf, url);
+ strbuf_addf(buf, "objects/%.*s/", 2, hex);
if (!only_two_digit_prefix)
strbuf_addf(buf, "%s", hex+2);