From 89b49fca88efae6b4d6bc4a8a421c94d945bb5df Mon Sep 17 00:00:00 2001 From: Kir_Antipov Date: Sun, 26 Sep 2021 22:31:30 +0300 Subject: [PATCH] Fixed Modrinth's primary file detection --- src/utils/modrinth-utils.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/utils/modrinth-utils.ts b/src/utils/modrinth-utils.ts index e3be86c..101f69d 100644 --- a/src/utils/modrinth-utils.ts +++ b/src/utils/modrinth-utils.ts @@ -8,13 +8,14 @@ export async function createVersion(id: string, data: Record, 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", {