Skip to content

Commit 0fdadc5

Browse files
rctaygitster
authored andcommitted
http-push: Normalise directory names when pushing to some WebDAV servers
Fix a bug when pushing to WebDAV servers which do not use a trailing slash for collection names. The previous implementation fails to see that the requested resource "refs/" is the same resource as "refs" and loads every reference twice (once for refs/ and once for refs). This implementation normalises every collection name by appending a trailing slash if necessary. This can be tested with old versions of Apache (such as the WebDAV server of GMX, Apache 2.0.63). Based-on-patch-by: Gabriel Corona <[email protected]> Signed-off-by: Tay Ray Chuan <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent cf688cc commit 0fdadc5

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

http-push.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1090,6 +1090,10 @@ static void handle_remote_ls_ctx(struct xml_ctx *ctx, int tag_closed)
10901090
if (tag_closed) {
10911091
if (!strcmp(ctx->name, DAV_PROPFIND_RESP) && ls->dentry_name) {
10921092
if (ls->dentry_flags & IS_DIR) {
1093+
1094+
/* ensure collection names end with slash */
1095+
str_end_url_with_slash(ls->dentry_name, &ls->dentry_name);
1096+
10931097
if (ls->flags & PROCESS_DIRS) {
10941098
ls->userFunc(ls);
10951099
}

0 commit comments

Comments
 (0)