@@ -87,6 +87,7 @@ static struct object_list *objects;
87
87
struct repo
88
88
{
89
89
char * url ;
90
+ char * path ;
90
91
int path_len ;
91
92
int has_info_refs ;
92
93
int can_update_info_refs ;
@@ -1424,9 +1425,19 @@ static void handle_remote_ls_ctx(struct xml_ctx *ctx, int tag_closed)
1424
1425
ls -> userFunc (ls );
1425
1426
}
1426
1427
} else if (!strcmp (ctx -> name , DAV_PROPFIND_NAME ) && ctx -> cdata ) {
1427
- ls -> dentry_name = xmalloc (strlen (ctx -> cdata ) -
1428
+ char * path = ctx -> cdata ;
1429
+ if (* ctx -> cdata == 'h' ) {
1430
+ path = strstr (path , "//" );
1431
+ if (path ) {
1432
+ path = strchr (path + 2 , '/' );
1433
+ }
1434
+ }
1435
+ if (path ) {
1436
+ path += remote -> path_len ;
1437
+ }
1438
+ ls -> dentry_name = xmalloc (strlen (path ) -
1428
1439
remote -> path_len + 1 );
1429
- strcpy (ls -> dentry_name , ctx -> cdata + remote -> path_len );
1440
+ strcpy (ls -> dentry_name , path + remote -> path_len );
1430
1441
} else if (!strcmp (ctx -> name , DAV_PROPFIND_COLLECTION )) {
1431
1442
ls -> dentry_flags |= IS_DIR ;
1432
1443
}
@@ -2206,10 +2217,11 @@ int main(int argc, char **argv)
2206
2217
if (!remote -> url ) {
2207
2218
char * path = strstr (arg , "//" );
2208
2219
remote -> url = arg ;
2220
+ remote -> path_len = strlen (arg );
2209
2221
if (path ) {
2210
- path = strchr (path + 2 , '/' );
2211
- if (path )
2212
- remote -> path_len = strlen (path );
2222
+ remote -> path = strchr (path + 2 , '/' );
2223
+ if (remote -> path )
2224
+ remote -> path_len = strlen (remote -> path );
2213
2225
}
2214
2226
continue ;
2215
2227
}
@@ -2238,8 +2250,9 @@ int main(int argc, char **argv)
2238
2250
rewritten_url = xmalloc (strlen (remote -> url )+ 2 );
2239
2251
strcpy (rewritten_url , remote -> url );
2240
2252
strcat (rewritten_url , "/" );
2253
+ remote -> path = rewritten_url + (remote -> path - remote -> url );
2254
+ remote -> path_len ++ ;
2241
2255
remote -> url = rewritten_url ;
2242
- ++ remote -> path_len ;
2243
2256
}
2244
2257
2245
2258
/* Verify DAV compliance/lock support */
0 commit comments