Fix desktop file uploads with extensions (#1741)

* fix(attachments): allow Markdown file uploads on desktop

Desktop file upload copied picked files through managed storage with bare picker extensions like md. Normalize those extensions at the command boundary and pass dot-prefixed extensions from the picker path.

* fix(attachments): stop enumerating generic file types

Generic file uploads should not depend on a hand-maintained non-image MIME table. Keep raster image inference for image handling and use octet-stream for other path-only uploads.

* test(attachments): cover picker extension format
This commit is contained in:
Mohamed Boudra
2026-06-26 14:45:45 +08:00
committed by GitHub
parent 862154541a
commit 28c5e55bd9
5 changed files with 82 additions and 48 deletions
+2 -2
View File
@@ -26,7 +26,7 @@ export async function readDesktopFileBytes(path: string): Promise<Uint8Array> {
const { path: managedPath } = await copyDesktopAttachmentFile({
attachmentId: crypto.randomUUID(),
sourcePath: path,
extension: getFileExtension(path).slice(1) || null,
extension: getFileExtension(path) || null,
});
const base64 = await readDesktopFileBase64(managedPath);
return base64ToUint8Array(base64);
@@ -63,7 +63,7 @@ async function pickFilesWithDesktopDialog(): Promise<PickedFile[] | null> {
const { path: managedPath } = await copyDesktopAttachmentFile({
attachmentId: crypto.randomUUID(),
sourcePath: filePath,
extension: getFileExtension(filePath).slice(1) || null,
extension: getFileExtension(filePath) || null,
});
const base64 = await readDesktopFileBase64(managedPath);