Skip to content

Commit

Permalink
Fixed Modrinth's primary file detection
Browse files Browse the repository at this point in the history
  • Loading branch information
Kir-Antipov committed Sep 26, 2021
1 parent b3b5a97 commit 89b49fc
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/utils/modrinth-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@ export async function createVersion(id: string, data: Record<string, any>, files
dependencies: [],
...data,
mod_id: id,
file_parts: files.map(x => x.name)
file_parts: files.map((_, i) => i.toString())
};

const form = new FormData();
form.append("data", JSON.stringify(data));
for (const file of files) {
form.append(file.name, await fileFromPath(file.path), file.name);
for (let i = 0; i < files.length; ++i) {
const file = files[i];
form.append(i.toString(), await fileFromPath(file.path), file.name);
}

const response = await fetch("https://api.modrinth.com/api/v1/version", {
Expand Down

0 comments on commit 89b49fc

Please sign in to comment.