mirror of
https://github.com/MultiMC/MultiMC5.git
synced 2025-01-16 04:13:11 +00:00
NOISSUE Improve path parsing for modrinth packs
This commit is contained in:
parent
1f1cdbe0a8
commit
f624754f0c
@ -311,7 +311,13 @@ void InstanceImportTask::processModrinth() {
|
||||
auto jsonFiles = Json::requireIsArrayOf<QJsonObject>(obj, "files", "modrinth.index.json");
|
||||
for(auto & obj: jsonFiles) {
|
||||
Modrinth::File file;
|
||||
file.path = Json::requireString(obj, "path");
|
||||
auto dirtyPath = Json::requireString(obj, "path");
|
||||
dirtyPath.replace('\\', '/');
|
||||
auto simplifiedPath = QDir::cleanPath(dirtyPath);
|
||||
QFileInfo fileInfo (simplifiedPath);
|
||||
if(simplifiedPath.startsWith("../") || simplifiedPath.contains("/../") || fileInfo.isAbsolute()) {
|
||||
throw JSONValidationError("Invalid path found in modpack files:\n\n" + simplifiedPath);
|
||||
}
|
||||
|
||||
// env doesn't have to be present, in that case mod is required
|
||||
auto env = Json::ensureObject(obj, "env");
|
||||
|
Loading…
Reference in New Issue
Block a user