fix: fix embed image mime type

This commit is contained in:
purocean
2022-03-07 18:58:44 +08:00
parent c9f32e3533
commit 2ffce48c51
+6 -1
View File
@@ -183,7 +183,12 @@ export default {
try {
const originSrc = node.getAttribute(DOM_ATTR_NAME.ORIGIN_SRC)
const res: Response = await ctx.api.fetchHttp(srcAttr)
const file = new File([await res.blob()], originSrc ? ctx.utils.path.basename(originSrc) : 'img')
const fileName = originSrc ? ctx.utils.path.basename(originSrc) : 'img'
const file = new File(
[await res.blob()],
fileName,
{ type: ctx.lib.mime.getType(fileName) || undefined }
)
let url: string | undefined
if (options.inlineLocalImage) {