Skip to content

Commit 800324c

Browse files
rctaygitster
authored andcommitted
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: http://marc.info/?l=git&m=125043105231327 Signed-off-by: Tay Ray Chuan <[email protected]> Tested-by: Thomas Schlichter <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 13354f5 commit 800324c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

http.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -719,7 +719,9 @@ void append_remote_object_url(struct strbuf *buf, const char *url,
719719
const char *hex,
720720
int only_two_digit_prefix)
721721
{
722-
strbuf_addf(buf, "%s/objects/%.*s/", url, 2, hex);
722+
end_url_with_slash(buf, url);
723+
724+
strbuf_addf(buf, "objects/%.*s/", 2, hex);
723725
if (!only_two_digit_prefix)
724726
strbuf_addf(buf, "%s", hex+2);
725727
}

0 commit comments

Comments
 (0)