Check for invalid path in GalaxyAPI::fileJsonNodeToGameFileVector

Skip the file if we get invalid path for some reason.
This should help with issue #200 (Crashes when downloading "secure")
This commit is contained in:
Sude 2021-08-06 11:25:54 +03:00
parent 584fef3988
commit d307d22195

View File

@ -342,6 +342,12 @@ std::vector<gameFile> galaxyAPI::fileJsonNodeToGameFileVector(const std::string&
std::string downlink_url = downlinkJson["downlink"].asString();
std::string path = this->getPathFromDownlinkUrl(downlink_url, gamename);
// Check to see if path ends in "/secure" which means that we got invalid path for some reason
boost::regex path_re("/secure$", boost::regex::perl | boost::regex::icase);
boost::match_results<std::string::const_iterator> what;
if (boost::regex_search(path, what, path_re))
continue;
gameFile gf;
gf.gamename = gamename;
gf.type = type;