diff --git a/package-lock.json b/package-lock.json index a350da90e..83d1852bd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -30,7 +30,7 @@ "i18next-fs-backend": "^2.1.5", "i18next-http-middleware": "^3.3.2", "image-size": "^1.0.2", - "jimp": "^0.22.12", + "jimp": "*", "json-bigint": "^1.0.0", "jsonwebtoken": "^9.0.1", "lambert-server": "^1.2.12", diff --git a/src/api/middlewares/ImageProxy.ts b/src/api/middlewares/ImageProxy.ts index 27c69ae2a..4213a4097 100644 --- a/src/api/middlewares/ImageProxy.ts +++ b/src/api/middlewares/ImageProxy.ts @@ -26,7 +26,7 @@ let sharp: undefined | false | { default: typeof import("sharp") } = undefined; let Jimp: JimpType | undefined = undefined; try { - Jimp = require("jimp") as JimpType; + Jimp = require("jimp") as JimpType; } catch { // empty } @@ -120,7 +120,11 @@ export async function ImageProxy(req: Request, res: Response) { const arrayBuffer = await request.arrayBuffer(); let resultBuffer = Buffer.from(arrayBuffer); - if (!sentImageProxyWarning && resizeSupported.has(contentType) && /^\d+x\d+$/.test(path[1])) { + if ( + !sentImageProxyWarning && + resizeSupported.has(contentType) && + /^\d+x\d+$/.test(path[1]) + ) { if (sharp !== false) { try { sharp = await import("sharp");