fix: use proper dir in ModrinthImporter

This commit is contained in:
Johannes Frohnmeyer 2023-10-03 20:14:41 +02:00
parent cbba1ab70a
commit 7a7d009e29
Signed by: Johannes
GPG Key ID: E76429612C2929F4
1 changed files with 2 additions and 2 deletions

View File

@ -42,8 +42,8 @@ public class ModrinthImporter extends Importer<ModrinthModpackManifest> {
protected void downloadMods(ModrinthModpackManifest manifest, Path instanceDir, ProcessState state) throws IOException {
if (manifest.files() != null) {
filesLoop: for (ModrinthModpackManifest.File file : manifest.files()) {
Path path = instanceDir.getParent().resolve(file.path()).toAbsolutePath().normalize();
if (!path.startsWith(instanceDir)) throw new IOException("Pack attempted to write file outside instance. This is unsupported!");
Path path = instanceDir.resolve(file.path()).toAbsolutePath().normalize();
if (!path.startsWith(instanceDir)) throw new IOException("Pack attempted to write file outside instance which is dangerous and thus unsupported: " + path);
String sha1 = file.hashes().sha1();
IOException failedDownload = new IOException("Could not download file");
for (String url : file.downloads()) {