Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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" ]
1 change: 0 additions & 1 deletion extension/chrome/elements/pgp_block.htm
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
<script src="/lib/sweetalert2.js"></script>
<script src="/lib/linkify.min.js"></script>
<script src="/lib/linkify-html.min.js"></script>
<script src="/lib/filesize.js"></script>
<script src="pgp_block.js" type="module"></script>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
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[] = [];
Expand All @@ -28,7 +27,7 @@
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);
const size = fileSize(attachments[i].length) as string;
const htmlContent = `<b>${Xss.escape(nameVisible)}</b>&nbsp;&nbsp;&nbsp;${size}<span class="progress"><span class="percent"></span></span>`;
const attachment = $(`<a href="#" index="${Number(i)}">`);
attachment.attr('title', name);
Expand Down
5 changes: 5 additions & 0 deletions extension/types/file-size.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
declare module 'filesize' {
export function fileSize(
bytes: number,
): string;
}
8 changes: 4 additions & 4 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 @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -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", "./extension/types/file-size.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"],
Expand Down
Loading