diff options
| author | Carl Hetherington <cth@carlh.net> | 2025-05-01 23:22:14 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2025-06-03 22:46:26 +0200 |
| commit | 80aea2d8e62ab14a8e6727254158f5de53eb363b (patch) | |
| tree | 6fbba77b9aa537120fac4632e23b24f2fc042fdc /src | |
| parent | d18acbf4deeee0b40cf0095af87e288849cbde13 (diff) | |
Allow destination path to be empty.
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/curl_uploader.cc | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/lib/curl_uploader.cc b/src/lib/curl_uploader.cc index fa18f2963..a8b6ece6d 100644 --- a/src/lib/curl_uploader.cc +++ b/src/lib/curl_uploader.cc @@ -91,11 +91,14 @@ CurlUploader::create_directory(boost::filesystem::path) void CurlUploader::upload_file(boost::filesystem::path from, boost::filesystem::path to, boost::uintmax_t& transferred, boost::uintmax_t total_size) { - curl_easy_setopt( - _curl, CURLOPT_URL, - /* Use generic_string so that we get forward-slashes in the path, even on Windows */ - String::compose("ftp://%1/%2/%3", _destination.host, _destination.path, to.generic_string()).c_str() - ); + string url = "ftp://" + _destination.host + "/"; + if (!_destination.path.empty()) { + url += _destination.path + "/"; + } + /* Use generic_string so that we get forward-slashes in the path, even on Windows */ + url += to.generic_string(); + + curl_easy_setopt(_curl, CURLOPT_URL, url.c_str()); dcp::File file(from, "rb"); if (!file) { |
