diff --git a/api.planx.uk/modules/file/service/uploadFile.ts b/api.planx.uk/modules/file/service/uploadFile.ts index f1ec699c82..1026ce1d20 100644 --- a/api.planx.uk/modules/file/service/uploadFile.ts +++ b/api.planx.uk/modules/file/service/uploadFile.ts @@ -1,6 +1,6 @@ import S3 from "aws-sdk/clients/s3"; import { customAlphabet } from "nanoid"; -import { getType } from "mime"; +import mime from "mime"; import { s3Factory } from "./utils"; import { isLiveEnv } from "../../../helpers"; const nanoid = customAlphabet("1234567890abcdefghijklmnopqrstuvwxyz", 8); @@ -64,7 +64,7 @@ export function generateFileParams( fileType: string | null; key: string; } { - const fileType = getType(filename); + const fileType = mime.getType(filename); const key = `${nanoid()}/${filename}`; const params = { diff --git a/api.planx.uk/package.json b/api.planx.uk/package.json index d62555af31..96c2bb72e9 100644 --- a/api.planx.uk/package.json +++ b/api.planx.uk/package.json @@ -34,7 +34,7 @@ "jsondiffpatch": "^0.5.0", "jsonwebtoken": "^9.0.2", "lodash": "^4.17.21", - "mime": "^3.0.0", + "mime": "^4.0.1", "multer": "^1.4.5-lts.1", "nanoid": "^3.3.7", "notifications-node-client": "^8.0.0", @@ -83,7 +83,7 @@ "@types/jsdom": "^21.1.6", "@types/jsonwebtoken": "^9.0.5", "@types/lodash": "^4.17.0", - "@types/mime": "^3.0.4", + "@types/mime": "^4.0.0", "@types/multer": "^1.4.11", "@types/node": "^18.19.13", "@types/passport": "^1.0.16", diff --git a/api.planx.uk/pnpm-lock.yaml b/api.planx.uk/pnpm-lock.yaml index 8167033f15..6738125df6 100644 --- a/api.planx.uk/pnpm-lock.yaml +++ b/api.planx.uk/pnpm-lock.yaml @@ -102,8 +102,8 @@ dependencies: specifier: ^4.17.21 version: 4.17.21 mime: - specifier: ^3.0.0 - version: 3.0.0 + specifier: ^4.0.1 + version: 4.0.1 multer: specifier: ^1.4.5-lts.1 version: 1.4.5-lts.1 @@ -188,8 +188,8 @@ devDependencies: specifier: ^4.17.0 version: 4.17.0 '@types/mime': - specifier: ^3.0.4 - version: 3.0.4 + specifier: ^4.0.0 + version: 4.0.0 '@types/multer': specifier: ^1.4.11 version: 1.4.11 @@ -2010,6 +2010,13 @@ packages: /@types/mime@3.0.4: resolution: {integrity: sha512-iJt33IQnVRkqeqC7PzBHPTC6fDlRNRW8vjrgqtScAhrmMwe8c4Eo7+fUGTa+XdWrpEgpyKWMYmi2dIwMAYRzPw==} + /@types/mime@4.0.0: + resolution: {integrity: sha512-5eEkJZ/BLvTE3vXGKkWlyTSUVZuzj23Wj8PoyOq2lt5I3CYbiLBOPb3XmCW6QcuOibIUE6emHXHt9E/F/rCa6w==} + deprecated: This is a stub types definition. mime provides its own type definitions, so you do not need this installed. + dependencies: + mime: 3.0.0 + dev: true + /@types/minimatch@5.1.2: resolution: {integrity: sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA==} dev: false @@ -6140,6 +6147,12 @@ packages: resolution: {integrity: sha512-jSCU7/VB1loIWBZe14aEYHU/+1UMEHoaO7qxCOVJOw9GgH72VAWppxNcjU+x9a2k3GSIBXNKxXQFqRvvZ7vr3A==} engines: {node: '>=10.0.0'} hasBin: true + dev: true + + /mime@4.0.1: + resolution: {integrity: sha512-5lZ5tyrIfliMXzFtkYyekWbtRXObT9OWa8IwQ5uxTBDHucNNwniRqo0yInflj+iYi5CBa6qxadGzGarDfuEOxA==} + engines: {node: '>=16'} + hasBin: true dev: false /mimic-fn@2.1.0: