summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2019-08-14 09:05:07 +0100
committerGitHub <noreply@github.com>2019-08-14 09:05:07 +0100
commit0f40e68e2f468169d711a806f6839781ae4f7a3e (patch)
tree3d07686771410c3aa95feaf0bfb507f13f69a867
parent08cfa43d0e1a9214a2f1239593686078e75e5636 (diff)
parent62b801388025488beee42c665d3470dadc2ce257 (diff)
downloadlibgit2-0f40e68e2f468169d711a806f6839781ae4f7a3e.tar.gz
Merge pull request #5187 from ianhattendorf/fix/clone-whitespace
clone: don't decode URL percent encodings
-rw-r--r--src/net.c2
-rw-r--r--tests/CMakeLists.txt2
-rw-r--r--tests/online/clone.c6
3 files changed, 8 insertions, 2 deletions
diff --git a/src/net.c b/src/net.c
index e35abbb94..a1dc408e0 100644
--- a/src/net.c
+++ b/src/net.c
@@ -94,7 +94,7 @@ int git_net_url_parse(git_net_url *url, const char *given)
if (has_path) {
const char *url_path = given + u.field_data[UF_PATH].off;
size_t url_path_len = u.field_data[UF_PATH].len;
- git_buf_decode_percent(&path, url_path, url_path_len);
+ git_buf_put(&path, url_path, url_path_len);
} else {
git_buf_puts(&path, "/");
}
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index a97e8fe21..c7fe8e102 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -69,5 +69,5 @@ ADD_CLAR_TEST(offline -v -xonline)
ADD_CLAR_TEST(invasive -v -score::ftruncate -sfilter::stream::bigfile -sodb::largefiles -siterator::workdir::filesystem_gunk -srepo::init -srepo::init::at_filesystem_root)
ADD_CLAR_TEST(online -v -sonline)
ADD_CLAR_TEST(gitdaemon -v -sonline::push)
-ADD_CLAR_TEST(ssh -v -sonline::push -sonline::clone::ssh_cert -sonline::clone::ssh_with_paths)
+ADD_CLAR_TEST(ssh -v -sonline::push -sonline::clone::ssh_cert -sonline::clone::ssh_with_paths -sonline::clone::path_whitespace_ssh)
ADD_CLAR_TEST(proxy -v -sonline::clone::proxy)
diff --git a/tests/online/clone.c b/tests/online/clone.c
index 60aaeeb0f..3f8ee7fe2 100644
--- a/tests/online/clone.c
+++ b/tests/online/clone.c
@@ -863,3 +863,9 @@ void test_online_clone__proxy_cred_callback_after_failed_url_creds(void)
git_buf_dispose(&url);
}
+
+void test_online_clone__path_whitespace(void)
+{
+ cl_git_pass(git_clone(&g_repo, "https://libgit2@dev.azure.com/libgit2/test/_git/spaces%20in%20the%20name", "./foo", &g_options));
+ cl_assert(git_path_exists("./foo/master.txt"));
+}