From 218cc98461ecc743b41091b42fcf36d8a8596506 Mon Sep 17 00:00:00 2001 From: Kir_Antipov Date: Tue, 31 May 2022 21:11:04 +0300 Subject: [PATCH] Not so quick quickfix of #6 Closes #6 --- src/utils/curseforge-utils.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/utils/curseforge-utils.ts b/src/utils/curseforge-utils.ts index de40fe7..2595f4d 100644 --- a/src/utils/curseforge-utils.ts +++ b/src/utils/curseforge-utils.ts @@ -102,6 +102,14 @@ export async function convertToCurseForgeVersions(gameVersions: string[], loader } export async function uploadFile(id: string, data: Record, file: File, token: string): Promise { + if (Array.isArray(data.relations?.projects) && (!data.relations.projects.length || data.parentFileID)) { + delete data.relations; + } + + if (data.gameVersions && data.parentFileID) { + delete data.gameVersions; + } + const form = new FormData(); form.append("file", await fileFromPath(file.path), file.name); form.append("metadata", JSON.stringify(data));