Fixed Modrinth's primary file detection

This commit is contained in:
Kir_Antipov 2021-09-26 22:31:30 +03:00
parent b3b5a975fb
commit 89b49fca88

View file

@ -8,13 +8,14 @@ export async function createVersion(id: string, data: Record<string, any>, files
dependencies: [], dependencies: [],
...data, ...data,
mod_id: id, mod_id: id,
file_parts: files.map(x => x.name) file_parts: files.map((_, i) => i.toString())
}; };
const form = new FormData(); const form = new FormData();
form.append("data", JSON.stringify(data)); form.append("data", JSON.stringify(data));
for (const file of files) { for (let i = 0; i < files.length; ++i) {
form.append(file.name, await fileFromPath(file.path), file.name); 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", { const response = await fetch("https://api.modrinth.com/api/v1/version", {