commit 0921e08fd73a69dae201e11e6feaf9227be19285 from: Stefan Sperling date: Thu Sep 24 10:49:36 2020 UTC remove redundant leading slashes from repository path when parsing URIs commit - 2751fe645d77dcd3e68167c7d2c26bb9146996d2 commit + 0921e08fd73a69dae201e11e6feaf9227be19285 blob - b30b0e06600022c9a11f2939a57084027107c1fe blob + bb30d5779ae63ad15f78b9792824daa68e1695e0 --- lib/fetch.c +++ lib/fetch.c @@ -305,6 +305,8 @@ got_fetch_parse_uri(char **proto, char **host, char ** } } + while (p[0] == '/' && p[1] == '/') + p++; *server_path = strdup(p); if (*server_path == NULL) { err = got_error_from_errno("strdup"); blob - 8f656219dfe4b7b2d76db4bb32e9c33b9c5f454d blob + f8fea68e3c733312ed6d4c1e5bd83b5b39082986 --- regress/fetch/fetch_test.c +++ regress/fetch/fetch_test.c @@ -84,8 +84,14 @@ fetch_parse_uri(void) NULL, NULL, NULL, NULL, NULL, GOT_ERR_PARSE_URI }, { "git://127.0.0.1/git/myrepo", + "git", "127.0.0.1", NULL, + "/git/myrepo", "myrepo", GOT_ERR_OK }, + { "git://127.0.0.1//git/myrepo", "git", "127.0.0.1", NULL, "/git/myrepo", "myrepo", GOT_ERR_OK }, + { "git://127.0.0.1/////git//myrepo", + "git", "127.0.0.1", NULL, + "/git//myrepo", "myrepo", GOT_ERR_OK }, { "http://127.0.0.1/git/myrepo", "http", "127.0.0.1", NULL, "/git/myrepo", "myrepo", GOT_ERR_OK },