Skip to content

Commit 7e2f2cd

Browse files
committed
fix(game/server): remove formidable
1 parent df3cc9d commit 7e2f2cd

File tree

3 files changed

+7
-21
lines changed

3 files changed

+7
-21
lines changed

game/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
"dependencies": {
1313
"@citizenfx/http-wrapper": "^0.2.2",
1414
"form-data": "^4.0.1",
15-
"formidable": "^3.5.2",
1615
"koa": "^2.15.4",
1716
"koa-body": "^6.0.1",
1817
"koa-router": "^13.0.1",

game/server/koa-router.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import { setHttpCallback } from '@citizenfx/http-wrapper';
66

77
import FormData from 'form-data';
88
import fetch from 'node-fetch';
9-
import { File } from 'formidable';
109
import { CaptureOptions, DataType } from './types';
1110
import { UploadStore } from './upload-store';
1211
import { readFile, unlink } from 'fs/promises';
@@ -33,7 +32,13 @@ export async function createServer(uploadStore: UploadStore) {
3332
return;
3433
}
3534

36-
const file = files['file'] as File;
35+
// dont blame me, but node runtime does not like formidable for some reason
36+
const file = files['file'] as any;
37+
if (!file) {
38+
ctx.status = 400;
39+
ctx.body = { status: 'error', message: 'No file provided' };
40+
return;
41+
}
3742

3843
try {
3944
const d = await readFile(file.filepath);

pnpm-lock.yaml

Lines changed: 0 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)