From 4d5f15b32e75c0bfab415c0ae62a9f9c275d2af1 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Wed, 5 Feb 2020 19:27:57 +0000 Subject: [PATCH 1/2] Update dependency file-type to v14 --- package.json | 2 +- yarn.lock | 24 +++++++++++++++--------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index 55191c44..81bcc348 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "cheerio": "1.0.0-rc.3", "commander": "4.1.0", "express": "4.17.1", - "file-type": "13.1.2", + "file-type": "14.1.1", "filenamify": "4.1.0", "fs-extra": "8.1.0", "got": "10.4.0", diff --git a/yarn.lock b/yarn.lock index e837d73a..e56a6897 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1011,6 +1011,11 @@ resolved "https://registry.yarnpkg.com/@types/color-name/-/color-name-1.1.1.tgz#1c1261bbeaa10a8055bbc5d8ab84b7b2afc846a0" integrity sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ== +"@types/debug@^4.1.5": + version "4.1.5" + resolved "https://registry.yarnpkg.com/@types/debug/-/debug-4.1.5.tgz#b14efa8852b7768d898906613c23f688713e02cd" + integrity sha512-Q1y515GcOdTHgagaVFhHnIFQ38ygs/kmxdNpvpou+raI9UO3YZcHDngBSYKQklcKlvA7iuQlmIKbzvmxcOE9CQ== + "@types/events@*": version "3.0.0" resolved "https://registry.yarnpkg.com/@types/events/-/events-3.0.0.tgz#2862f3f58a9a7f7c3e78d79f130dd4d71c25c2a7" @@ -3706,13 +3711,13 @@ file-entry-cache@^5.0.1: dependencies: flat-cache "^2.0.1" -file-type@13.1.2: - version "13.1.2" - resolved "https://registry.yarnpkg.com/file-type/-/file-type-13.1.2.tgz#0e5b72bca7569c152e2d5a84ece07e94f77f833f" - integrity sha512-NiHXbmclwHN38eHZfRklosbm7/W+1yacDzRCyddd0NiyuJUArQDmzJ8GPSFJGl82+I59u7sNGfcAVnJsfXJb8A== +file-type@14.1.1: + version "14.1.1" + resolved "https://registry.yarnpkg.com/file-type/-/file-type-14.1.1.tgz#d624d512da648cf8916d1416303297493a97011b" + integrity sha512-fGmNwmRgDi3uMDNbJfRRKaOUGN/uzeWRl2Ti9RJdvLpzFMKbl5cBGP3ngHYKiBSbHPB8wzMckP9x9SixJDFftg== dependencies: readable-web-to-node-stream "^2.0.0" - strtok3 "^5.0.2" + strtok3 "^6.0.0" token-types "^2.0.0" typedarray-to-buffer "^3.1.5" @@ -8790,12 +8795,13 @@ strip-outer@^1.0.1: dependencies: escape-string-regexp "^1.0.2" -strtok3@^5.0.2: - version "5.0.2" - resolved "https://registry.yarnpkg.com/strtok3/-/strtok3-5.0.2.tgz#bb81f1f56742e16f1a30ccce5dc3d9498aa5475a" - integrity sha512-EFeVpFC5qDsqPEJSrIYyS/ueFBknGhgSK9cW+YAJF/cgJG/KSjoK7X6rK5xnpcLe7y1LVkVFCXWbAb+ClNKzKQ== +strtok3@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/strtok3/-/strtok3-6.0.0.tgz#d6b900863daeacfe6c1724c6e7bb36d7a58e83c8" + integrity sha512-ZXlmE22LZnIBvEU3n/kZGdh770fYFie65u5+2hLK9s74DoFtpkQIdBZVeYEzlolpGa+52G5IkzjUWn+iXynOEQ== dependencies: "@tokenizer/token" "^0.1.1" + "@types/debug" "^4.1.5" debug "^4.1.1" peek-readable "^3.1.0" From 87c9abe9da10886ab51fbf1267ccca20519f91cc Mon Sep 17 00:00:00 2001 From: Pavel Djundik Date: Thu, 6 Feb 2020 12:41:43 +0200 Subject: [PATCH 2/2] Change minimumBytes in file-type --- src/plugins/uploader.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/uploader.js b/src/plugins/uploader.js index ad4070e4..0c2242c3 100644 --- a/src/plugins/uploader.js +++ b/src/plugins/uploader.js @@ -234,7 +234,7 @@ class Uploader { // Returns a string with the type otherwise static async getFileType(filePath) { try { - const buffer = readChunk.sync(filePath, 0, fileType.minimumBytes); + const buffer = await readChunk(filePath, 0, 5120); // returns {ext, mime} if found, null if not. const file = await fileType.fromBuffer(buffer);