pass through mimetype rather than assuming data uri
This commit is contained in:
@@ -886,7 +886,7 @@ let ComposerPost = React.memo(function ComposerPost({
|
||||
)
|
||||
|
||||
const onPhotoPasted = useCallback(
|
||||
async (uri: string) => {
|
||||
async (uri: string, mimeType?: string) => {
|
||||
if (
|
||||
uri.startsWith('data:video/') ||
|
||||
(isWeb && uri.startsWith('data:image/gif'))
|
||||
@@ -905,7 +905,8 @@ let ComposerPost = React.memo(function ComposerPost({
|
||||
.then(blob => new File([blob], name, {type: mimeType}))
|
||||
onSelectVideo(post.id, await getVideoMetadata(file))
|
||||
} else {
|
||||
const res = await pasteImage(uri)
|
||||
const res = await pasteImage(uri, mimeType)
|
||||
|
||||
onImageAdd([res])
|
||||
}
|
||||
},
|
||||
|
||||
@@ -130,7 +130,7 @@ export function TextInput({
|
||||
const file = files.find(f => isAcceptedImageMimeType(f.type))
|
||||
|
||||
if (file) {
|
||||
onPhotoPasted(file.data)
|
||||
onPhotoPasted(file.data, file.type)
|
||||
}
|
||||
},
|
||||
[onPhotoPasted],
|
||||
|
||||
@@ -26,7 +26,7 @@ export type TextInputProps = {
|
||||
hasRightPadding: boolean
|
||||
isActive: boolean
|
||||
setRichText: (v: RichText) => void
|
||||
onPhotoPasted: (uri: string) => void
|
||||
onPhotoPasted: (uri: string, mimeType?: string) => void
|
||||
onPressPublish: (richtext: RichText) => void
|
||||
onNewLink: (uri: string) => void
|
||||
onError: (err: string) => void
|
||||
|
||||
Reference in New Issue
Block a user