Skip to content

Commit

Permalink
Not so quick quickfix of #6
Browse files Browse the repository at this point in the history
Closes #6
  • Loading branch information
Kir-Antipov committed May 31, 2022
1 parent 7518e3b commit 218cc98
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/utils/curseforge-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,14 @@ export async function convertToCurseForgeVersions(gameVersions: string[], loader
}

export async function uploadFile(id: string, data: Record<string, any>, file: File, token: string): Promise<number> {
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));
Expand Down

0 comments on commit 218cc98

Please sign in to comment.