mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-04 07:30:41 +08:00
Allow more complex URLs when downloading from Printables
This commit is contained in:
parent
9974e95661
commit
6e75a2e16d
@ -66,11 +66,11 @@ void open_folder(const std::string& path)
|
|||||||
|
|
||||||
std::string filename_from_url(const std::string& url)
|
std::string filename_from_url(const std::string& url)
|
||||||
{
|
{
|
||||||
// TODO: can it be done with curl?
|
std::string url_plain = std::string(url.begin(), std::find(url.begin(), url.end(), '?'));
|
||||||
size_t slash = url.find_last_of("/");
|
size_t slash = url_plain.find_last_of("/");
|
||||||
if (slash == std::string::npos && slash != url.size() - 1)
|
if (slash == std::string::npos)
|
||||||
return std::string();
|
return std::string();
|
||||||
return url.substr(slash + 1, url.size() - slash + 1);
|
return std::string(url_plain.begin() + slash + 1, url_plain.end());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user