diff --git a/src/lib/media/picker.shared.ts b/src/lib/media/picker.shared.ts index 96e82e4c72..d739faf13e 100644 --- a/src/lib/media/picker.shared.ts +++ b/src/lib/media/picker.shared.ts @@ -3,8 +3,9 @@ import { launchImageLibraryAsync, MediaTypeOptions, } from 'expo-image-picker' -import {getDataUriSize} from './util' + import * as Toast from 'view/com/util/Toast' +import {getDataUriSize} from './util' export async function openPicker(opts?: ImagePickerOptions) { const response = await launchImageLibraryAsync({ @@ -26,7 +27,7 @@ export async function openPicker(opts?: ImagePickerOptions) { return false }) .map(image => ({ - mime: 'image/jpeg', + mime: image.mimeType || 'image/jpeg', height: image.height, width: image.width, path: image.uri, diff --git a/src/state/gallery.ts b/src/state/gallery.ts index db0f8ee861..a376ae641a 100644 --- a/src/state/gallery.ts +++ b/src/state/gallery.ts @@ -91,6 +91,7 @@ export async function pasteImage( uri: string, ): Promise { const {width, height} = await getImageDim(uri) + const match = /^data:(.+?);/.exec(uri) return { alt: '', @@ -98,7 +99,7 @@ export async function pasteImage( path: uri, width: width, height: height, - mime: 'image/jpeg', + mime: match ? match[1] : 'image/jpeg', }, } }