Skip to content

Commit

Permalink
feat(asset-server-plugin): Update Sharp to v0.33.2
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelbromley committed Mar 12, 2024
1 parent 375952d commit f3d45a0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions packages/asset-server-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"@types/express": "^4.17.21",
"@types/fs-extra": "^11.0.4",
"@types/node-fetch": "^2.6.11",
"@types/sharp": "^0.30.4",
"@types/sharp": "^0.32.0",
"@vendure/common": "2.2.0-next.5",
"@vendure/core": "2.2.0-next.5",
"express": "^4.18.3",
Expand All @@ -35,8 +35,8 @@
"typescript": "5.3.3"
},
"dependencies": {
"file-type": "^16.5.3",
"fs-extra": "^11.1.1",
"sharp": "~0.32.5"
"file-type": "^19.0.0",
"fs-extra": "^11.2.0",
"sharp": "~0.33.2"
}
}
6 changes: 3 additions & 3 deletions packages/asset-server-plugin/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
} from '@vendure/core';
import { createHash } from 'crypto';
import express, { NextFunction, Request, Response } from 'express';
import { fromBuffer } from 'file-type';
import { fileTypeFromBuffer } from 'file-type';
import fs from 'fs-extra';
import path from 'path';

Expand Down Expand Up @@ -244,7 +244,7 @@ export class AssetServerPlugin implements NestModule, OnApplicationBootstrap {
const file = await AssetServerPlugin.assetStorage.readFileToBuffer(key);
let mimeType = this.getMimeType(key);
if (!mimeType) {
mimeType = (await fromBuffer(file))?.mime || 'application/octet-stream';
mimeType = (await fileTypeFromBuffer(file))?.mime || 'application/octet-stream';
}
res.contentType(mimeType);
res.setHeader('content-security-policy', "default-src 'self'");
Expand Down Expand Up @@ -289,7 +289,7 @@ export class AssetServerPlugin implements NestModule, OnApplicationBootstrap {
}
let mimeType = this.getMimeType(cachedFileName);
if (!mimeType) {
mimeType = (await fromBuffer(imageBuffer))?.mime || 'image/jpeg';
mimeType = (await fileTypeFromBuffer(imageBuffer))?.mime || 'image/jpeg';
}
res.set('Content-Type', mimeType);
res.setHeader('content-security-policy', "default-src 'self'");
Expand Down

0 comments on commit f3d45a0

Please sign in to comment.