Commit a2d895c4 authored by netsweeper's avatar netsweeper
Browse files

productbuild: use curl to escape pkg-ref urls

Fixes: #18645
parent f49efe28
Pipeline #124772 failed with stage
......@@ -10,6 +10,12 @@
#include "cmSystemTools.h"
#include "cmXMLWriter.h"
#if defined(CMAKE_BUILD_WITH_CMAKE)
# include "cmCurl.h"
# include "cmFileLockResult.h"
# include "cm_curl.h"
#endif
cmCPackPKGGenerator::cmCPackPKGGenerator()
{
this->componentPackageMethod = ONE_PACKAGE;
......@@ -224,8 +230,18 @@ void cmCPackPKGGenerator::CreateChoice(const cmCPackComponent& component,
xout.Content(this->GetOption("CPACK_DOWNLOAD_SITE"));
xout.Content(this->GetPackageName(component));
} else {
xout.Content("file:./");
xout.Content(relativePackageLocation);
::CURL* curl;
::curl_global_init(CURL_GLOBAL_DEFAULT);
curl = ::curl_easy_init();
if (curl) {
char * escapedURL = curl_easy_escape(curl, relativePackageLocation.c_str(), 0);
if (escapedURL) {
relativePackageLocation = escapedURL;
curl_free(escapedURL);
}
::curl_global_cleanup();
}
xout.Content("file:./" + relativePackageLocation);
}
xout.EndElement(); // pkg-ref
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment