Fix image uploads using the wrong format (#2380)
* fix(app): preserve image attachment MIME types Image intake discarded clipboard and desktop path metadata, then guessed JPEG when a later file object had no type. Resolve MIME once at the platform boundary and require it downstream. * fix(app): honor native picker MIME metadata
This commit is contained in:
@@ -321,7 +321,11 @@ describe("pickAndPersistImages", () => {
|
||||
const persister = createFakePersister();
|
||||
const result = await pickAndPersistImages({
|
||||
pickImages: async () => [
|
||||
{ source: { kind: "file_uri", uri: "/tmp/x.jpg" }, mimeType: null, fileName: null },
|
||||
{
|
||||
source: { kind: "file_uri", uri: "/tmp/x.jpg" },
|
||||
mimeType: "image/jpeg",
|
||||
fileName: null,
|
||||
},
|
||||
],
|
||||
persister,
|
||||
});
|
||||
|
||||
@@ -93,7 +93,7 @@ export async function pickAndPersistImages(input: {
|
||||
return await Promise.all(
|
||||
result.map(async (picked) => {
|
||||
const fileName = picked.fileName ?? null;
|
||||
const mimeType = picked.mimeType || "image/jpeg";
|
||||
const mimeType = picked.mimeType;
|
||||
if (picked.source.kind === "blob") {
|
||||
return await input.persister.persistFromBlob({
|
||||
blob: picked.source.blob,
|
||||
|
||||
Reference in New Issue
Block a user