Fix galaxyAPI::getPathFromDownlinkUrl with Fastly CDN urls

Fastly CDN urls don't contain query strings
This commit is contained in:
Sude 2024-08-22 18:13:44 +03:00
parent b4c6638e19
commit 52b8bdc8fa

View File

@ -567,6 +567,11 @@ std::string galaxyAPI::getPathFromDownlinkUrl(const std::string& downlink_url, c
else else
filename_end_pos = downlink_url_unescaped.find_first_of("?"); filename_end_pos = downlink_url_unescaped.find_first_of("?");
// Downlink doesn't contain "?path=" or "?"
// Set end pos to length
if (filename_end_pos == std::string::npos)
filename_end_pos = downlink_url_unescaped.length();
if (downlink_url_unescaped.find("/" + gamename + "/") != std::string::npos) if (downlink_url_unescaped.find("/" + gamename + "/") != std::string::npos)
{ {
path.assign(downlink_url_unescaped.begin()+downlink_url_unescaped.find("/" + gamename + "/"), downlink_url_unescaped.begin()+filename_end_pos); path.assign(downlink_url_unescaped.begin()+downlink_url_unescaped.find("/" + gamename + "/"), downlink_url_unescaped.begin()+filename_end_pos);