diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 08875ac9b1f..75f53724143 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -32,5 +32,3 @@ updates: update-types: ["version-update:semver-major"] - dependency-name: "chai-as-promised" update-types: ["version-update:semver-major"] - - dependency-name: "filesize" - versions: [ ">= 10.1.3" ] diff --git a/extension/chrome/elements/pgp_block.htm b/extension/chrome/elements/pgp_block.htm index f8f07a16198..ed3c39c3bfb 100644 --- a/extension/chrome/elements/pgp_block.htm +++ b/extension/chrome/elements/pgp_block.htm @@ -41,7 +41,6 @@ - diff --git a/extension/chrome/elements/pgp_block_modules/pgp-block-attachments-module.ts b/extension/chrome/elements/pgp_block_modules/pgp-block-attachments-module.ts index add3d36856c..11829a30b7f 100644 --- a/extension/chrome/elements/pgp_block_modules/pgp-block-attachments-module.ts +++ b/extension/chrome/elements/pgp_block_modules/pgp-block-attachments-module.ts @@ -14,8 +14,7 @@ import { XssSafeFactory } from '../../../js/common/xss-safe-factory.js'; import { Str } from '../../../js/common/core/common.js'; import { AttachmentWarnings } from '../shared/attachment_warnings.js'; import { MsgUtil } from '../../../js/common/core/crypto/pgp/msg-util.js'; - -declare const filesize: { filesize: (size: number) => number }; +import { filesize } from 'filesize'; export class PgpBlockViewAttachmentsModule { public includedAttachments: Attachment[] = []; @@ -28,7 +27,9 @@ export class PgpBlockViewAttachmentsModule { for (const i of attachments.keys()) { const name = attachments[i].name ? Str.stripPgpOrGpgExtensionIfPresent(attachments[i].name) : 'noname'; const nameVisible = name.length > 100 ? name.slice(0, 100) + '…' : name; - const size = filesize.filesize(attachments[i].length); + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call + const size = filesize(attachments[i].length); + const htmlContent = `${Xss.escape(nameVisible)}   ${size}`; const attachment = $(``); attachment.attr('title', name); diff --git a/package-lock.json b/package-lock.json index c3257df0399..18c5a03e0ee 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,7 +15,7 @@ "bootstrap": "4.6.2", "clipboard": "2.0.11", "dompurify": "3.2.5", - "filesize": "10.1.2", + "filesize": "10.1.6", "fs-extra": "^11.3.0", "globby": "^14.1.0", "iso-8859-2": "1.0.0", @@ -5101,9 +5101,9 @@ } }, "node_modules/filesize": { - "version": "10.1.2", - "resolved": "https://registry.npmjs.org/filesize/-/filesize-10.1.2.tgz", - "integrity": "sha512-Dx770ai81ohflojxhU+oG+Z2QGvKdYxgEr9OSA8UVrqhwNHjfH9A8f5NKfg83fEH8ZFA5N5llJo5T3PIoZ4CRA==", + "version": "10.1.6", + "resolved": "https://registry.npmjs.org/filesize/-/filesize-10.1.6.tgz", + "integrity": "sha512-sJslQKU2uM33qH5nqewAwVB2QgR6w1aMNsYUp3aN5rMRyXEwJGmZvaWzeJFNTOXWlHQyBFCWrdj3fV/fsTOX8w==", "license": "BSD-3-Clause", "engines": { "node": ">= 10.4.0" diff --git a/package.json b/package.json index a2fbbc0967c..807fe40a487 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,7 @@ "bootstrap": "4.6.2", "clipboard": "2.0.11", "dompurify": "3.2.5", - "filesize": "10.1.2", + "filesize": "10.1.6", "fs-extra": "^11.3.0", "globby": "^14.1.0", "iso-8859-2": "1.0.0", diff --git a/scripts/build.js b/scripts/build.js index ceecdb1091e..2cde8736111 100644 --- a/scripts/build.js +++ b/scripts/build.js @@ -62,7 +62,7 @@ const copyDependencies = async () => { ['squire-rte/dist/squire.js', 'lib/squire.js'], ['clipboard/dist/clipboard.js', 'lib/clipboard.js'], ['@flowcrypt/fine-uploader/fine-uploader/fine-uploader.js', 'lib/fine-uploader.js'], - ['filesize/dist/filesize.js', 'lib/filesize.js'], + ['filesize/dist/filesize.esm.js', 'lib/filesize.js'], // Using legacy build due to Puppeteer compatibility issue (Promise.withResolvers error) // Reference: https://github.com/mozilla/pdf.js/issues/18006#issuecomment-2078739672 ['pdfjs-dist/legacy/build/pdf.min.mjs', 'lib/pdf.min.mjs'], diff --git a/tsconfig.json b/tsconfig.json index 2aad19adba8..aff23c223e6 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -27,7 +27,7 @@ "dompurify": ["../node_modules/dompurify/dist/purify.cjs.d.ts", "lib/purify.js", "COMMENT"], "fine-uploader": ["lib/fine-uploader.js", "COMMENT"], "clipboard": ["lib/clipboard.js", "COMMENT"], - "filesize": ["lib/filesize.js", "COMMENT"], + "filesize": ["lib/filesize.js", "../node_modules/filesize/types/filesize.d.ts"], "iso-8859-2": ["lib/iso-8859-2.js", "COMMENT"], "zxcvbn": ["lib/zxcvbn.js", "COMMENT"], "emailjs-mime-parser": ["lib/emailjs/emailjs-mime-parser.js", "COMMENT"],