NOISSUE fix bad redirect URLs provided by the curse CDN

MultiMC now parses the HTTP Location header in a (more) tolerant mode.
This commit is contained in:
Petr Mrázek
2018-01-21 03:49:54 +01:00
parent 0942867ecc
commit c33b4e252f
4 changed files with 50 additions and 4 deletions

View File

@ -48,7 +48,13 @@ void Flame::FileResolvingTask::netJobFinished()
continue;
}
out.fileName = Json::requireString(obj, "FileNameOnDisk");
out.url = Json::requireString(obj, "DownloadURL");
auto urlString = Json::requireString(obj, "DownloadURL");
urlString.replace(' ', "%20");
out.url = QUrl(urlString, QUrl::StrictMode);
if(!out.url.isValid())
{
throw "Perkele!";
}
// This is a piece of a Flame project JSON pulled out into the file metadata (here) for convenience
// It is also optional
QJsonObject projObj = Json::ensureObject(obj, "_Project", {});

View File

@ -2,6 +2,7 @@
#include <QString>
#include <QVector>
#include <QUrl>
namespace Flame
{
@ -15,7 +16,7 @@ struct File
// our
bool resolved = false;
QString fileName;
QString url;
QUrl url;
QString targetFolder = QLatin1Literal("mods");
enum class Type
{