diff options
author | dec05eba <dec05eba@protonmail.com> | 2019-04-08 21:02:51 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-08-18 23:38:23 +0200 |
commit | 0cae593b94c4fdfe100516c7f08f75e40bc1e089 (patch) | |
tree | dc74c8fccce760d9b85247cc1e401890ef09f424 /src/Cache.cpp | |
parent | 983be4253f2ea3827d78db97afcc666664ae75ed (diff) |
Move room setName to its own function, escape commands
Diffstat (limited to 'src/Cache.cpp')
-rw-r--r-- | src/Cache.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
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 <boost/filesystem/convenience.hpp> #include <process.hpp> #include <odhtdb/Hash.hpp> @@ -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); |