From 0cae593b94c4fdfe100516c7f08f75e40bc1e089 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Mon, 8 Apr 2019 21:02:51 +0200 Subject: Move room setName to its own function, escape commands --- src/Cache.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/Cache.cpp') diff --git a/src/Cache.cpp b/src/Cache.cpp index 82f31b9..bb87857 100644 --- a/src/Cache.cpp +++ b/src/Cache.cpp @@ -3,6 +3,7 @@ #include "../include/dchat/FileUtil.hpp" #include "../include/dchat/Gif.hpp" #include "../include/dchat/Storage.hpp" +#include "../include/dchat/Process.hpp" #include #include #include @@ -351,8 +352,8 @@ namespace dchat string downloadLimitBytesStr = to_string(downloadLimitBytes); std::string cmdUtf8 = "curl -L --silent -o '"; - cmdUtf8 += filepath.string(); - cmdUtf8 += "' --max-filesize " + downloadLimitBytesStr + " --range 0-" + downloadLimitBytesStr + " --url '" + url + "'"; + cmdUtf8 += escapeCommand(filepath.string()); + cmdUtf8 += "' --max-filesize " + downloadLimitBytesStr + " --range 0-" + downloadLimitBytesStr + " --url '" + escapeCommand(url) + "'"; Process::string_type cmd = toNativeString(cmdUtf8); // TODO: Use this instead of curl on windows: certutil.exe -urlcache -split -f "https://url/to/file" path/and/name/to/save/as/file Process *process = new Process(cmd, toNativeString(""), nullptr, nullptr, false); -- cgit v1.2.3