refactor: Upgrade to mime 4.0.4 (#9363)

This commit is contained in:
Antoine Cormouls
2024-10-23 20:03:48 +02:00
committed by GitHub
parent 412e72463e
commit 3a9442a42f
5 changed files with 36 additions and 58 deletions

View File

@@ -1,6 +1,5 @@
import { GraphQLNonNull } from 'graphql';
import { request } from 'http';
import { getExtension } from 'mime';
import { mutationWithClientMutationId } from 'graphql-relay';
import Parse from 'parse/node';
import * as defaultGraphQLTypes from './defaultGraphQLTypes';
@@ -17,8 +16,9 @@ const handleUpload = async (upload, config) => {
delete headers['host'];
delete headers['content-length'];
const stream = createReadStream();
const mime = (await import('mime')).default;
try {
const ext = getExtension(mimetype);
const ext = mime.getExtension(mimetype);
const fullFileName = filename.endsWith(`.${ext}`) ? filename : `${filename}.${ext}`;
const serverUrl = new URL(config.serverURL);
const fileInfo = await new Promise((resolve, reject) => {