fix: validate whitelisted download urls

This commit is contained in:
flow
2022-05-15 15:58:23 -03:00
parent 78cf0c73c8
commit 7194bb1b81
3 changed files with 26 additions and 3 deletions

View File

@ -545,7 +545,7 @@ void InstanceImportTask::processModrinth() {
file.hashAlgorithm = hashAlgorithm;
// Do not use requireUrl, which uses StrictMode, instead use QUrl's default TolerantMode (as Modrinth seems to incorrectly handle spaces)
file.download = Json::requireString(Json::ensureArray(obj, "downloads").first(), "Download URL for " + file.path);
if (!file.download.isValid())
if (!file.download.isValid() || !Modrinth::validadeDownloadUrl(file.download))
{
throw JSONValidationError("Download URL for " + file.path + " is not a correctly formatted URL");
}