Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0f40e68

Browse files
authored
Merge pull request libgit2#5187 from ianhattendorf/fix/clone-whitespace
clone: don't decode URL percent encodings
2 parents 08cfa43 + 62b8013 commit 0f40e68

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

src/net.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ int git_net_url_parse(git_net_url *url, const char *given)
9494
if (has_path) {
9595
const char *url_path = given + u.field_data[UF_PATH].off;
9696
size_t url_path_len = u.field_data[UF_PATH].len;
97-
git_buf_decode_percent(&path, url_path, url_path_len);
97+
git_buf_put(&path, url_path, url_path_len);
9898
} else {
9999
git_buf_puts(&path, "/");
100100
}

tests/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,5 +69,5 @@ ADD_CLAR_TEST(offline -v -xonline)
6969
ADD_CLAR_TEST(invasive -v -score::ftruncate -sfilter::stream::bigfile -sodb::largefiles -siterator::workdir::filesystem_gunk -srepo::init -srepo::init::at_filesystem_root)
7070
ADD_CLAR_TEST(online -v -sonline)
7171
ADD_CLAR_TEST(gitdaemon -v -sonline::push)
72-
ADD_CLAR_TEST(ssh -v -sonline::push -sonline::clone::ssh_cert -sonline::clone::ssh_with_paths)
72+
ADD_CLAR_TEST(ssh -v -sonline::push -sonline::clone::ssh_cert -sonline::clone::ssh_with_paths -sonline::clone::path_whitespace_ssh)
7373
ADD_CLAR_TEST(proxy -v -sonline::clone::proxy)

tests/online/clone.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -863,3 +863,9 @@ void test_online_clone__proxy_cred_callback_after_failed_url_creds(void)
863863

864864
git_buf_dispose(&url);
865865
}
866+
867+
void test_online_clone__path_whitespace(void)
868+
{
869+
cl_git_pass(git_clone(&g_repo, "https://[email protected]/libgit2/test/_git/spaces%20in%20the%20name", "./foo", &g_options));
870+
cl_assert(git_path_exists("./foo/master.txt"));
871+
}

0 commit comments

Comments
 (0)