kioslave: pass percentage-encoded URL to curl from curl slave

fixes transfer actions (e.g. stat) on file/directories with whitespace in
their filename

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2024-03-18 23:34:16 +02:00
parent b163f7c35c
commit 3bc5e8c500

View file

@ -763,7 +763,9 @@ bool CurlProtocol::setupCurl(const KUrl &url, const bool ftporsftp)
curl_easy_setopt(m_curl, CURLOPT_USE_SSL, (long)CURLUSESSL_TRY);
// curl_easy_setopt(m_curl, CURLOPT_VERBOSE, 1L); // debugging
const QByteArray urlbytes = url.prettyUrl().toLocal8Bit();
// NOTE: the URL path has to be percentage-encoded, otherwise curl will reject it if it
// contains whitespace for example
const QByteArray urlbytes = url.toEncoded();
CURLcode curlresult = curl_easy_setopt(m_curl, CURLOPT_URL, urlbytes.constData());
if (curlresult != CURLE_OK) {
KIO_CURL_ERROR(curlresult);