mobile: fix attachment downloads failing on mobile

This commit is contained in:
Ammar Ahmed
2024-11-23 16:39:08 +05:00
committed by Ammar Ahmed
parent 48459efdb1
commit 4ee2923181
16 changed files with 113 additions and 656 deletions

View File

@@ -23,11 +23,11 @@ export async function getFileNameWithExtension(
): Promise<string> {
if (!mime || mime === "application/octet-stream") return filename;
const { default: mimeDB } = await import("mime");
const { default: mimeDB } = await import("mime-db");
const extensions = mimeDB.getAllExtensions(mime);
const { extensions } = mimeDB[mime] || {};
if (!extensions || extensions.size === 0) return filename;
if (!extensions || extensions.length === 0) return filename;
for (const ext of extensions) {
if (filename.endsWith(ext)) return filename;