Skip to content

Commit

Permalink
security: upgrade file-type dependency for cve https://cve.mitre.org/…
Browse files Browse the repository at this point in the history
  • Loading branch information
restjohn committed May 15, 2024
1 parent 47486e1 commit 19e0c70
Show file tree
Hide file tree
Showing 3 changed files with 153 additions and 18 deletions.
10 changes: 5 additions & 5 deletions lib/tiles/creator/tileCreator.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import fileType from 'file-type';
import * as fileType from 'file-type';
import proj4 from 'proj4';
import ProjectTile from './projectTile';

Expand Down Expand Up @@ -138,12 +138,12 @@ export class TileCreator {

/**
* Adds a tile and reprojects it if necessary before drawing it into the target canvas
* @param tileData
* @param gridColumn
* @param gridRow
* @param tileData a `string` file path or `Buffer` containing image data
* @param gridColumn `number`
* @param gridRow `number`
*/
async addTile(tileData: any, gridColumn: number, gridRow: number): Promise<void> {
const type = fileType(tileData);
const type = await (typeof tileData === 'string' ? fileType.fromFile(tileData) : fileType.fromBuffer(tileData));
const tile = await ImageUtils.getImage(tileData, type.mime);
this.tileContext.clearRect(0, 0, this.tileMatrix.tile_width, this.tileMatrix.tile_height);
this.tileContext.drawImage(tile.image, 0, 0);
Expand Down
159 changes: 147 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"@turf/polygon-to-line": "6.5.0",
"@types/geojson": "7946.0.8",
"@types/proj4": "2.5.2",
"file-type": "12.4.0",
"file-type": "^16.5.4",
"image-size": "0.8.3",
"lodash": "4.17.21",
"proj4": "2.8.0",
Expand Down

0 comments on commit 19e0c70

Please sign in to comment.