mirror of
https://github.com/Kir-Antipov/mc-publish.git
synced 2025-01-01 11:24:43 -05:00
parent
7518e3b7f8
commit
218cc98461
1 changed files with 8 additions and 0 deletions
|
@ -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));
|
||||
|
|
Loading…
Reference in a new issue