mirror of
https://github.com/marktext/marktext.git
synced 2025-05-02 19:41:39 +08:00
Merge 5775b28a20
into 11c8cc1e19
This commit is contained in:
commit
93460f2368
@ -149,12 +149,12 @@ export const uploadImage = async (pathname, image, preferences) => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const uploadByCommand = async (uploader, filepath) => {
|
const uploadByCommand = async (uploader, filepath, suffix = '') => {
|
||||||
let isPath = true
|
let isPath = true
|
||||||
if (typeof filepath !== 'string') {
|
if (typeof filepath !== 'string') {
|
||||||
isPath = false
|
isPath = false
|
||||||
const data = new Uint8Array(filepath)
|
const data = new Uint8Array(filepath)
|
||||||
filepath = path.join(tmpdir(), +new Date())
|
filepath = path.join(tmpdir(), +new Date() + suffix)
|
||||||
await fs.writeFile(filepath, data)
|
await fs.writeFile(filepath, data)
|
||||||
}
|
}
|
||||||
if (uploader === 'picgo') {
|
if (uploader === 'picgo') {
|
||||||
@ -224,7 +224,7 @@ export const uploadImage = async (pathname, image, preferences) => {
|
|||||||
switch (currentUploader) {
|
switch (currentUploader) {
|
||||||
case 'picgo':
|
case 'picgo':
|
||||||
case 'cliScript':
|
case 'cliScript':
|
||||||
uploadByCommand(currentUploader, reader.result)
|
uploadByCommand(currentUploader, reader.result, path.extname(image.name))
|
||||||
break
|
break
|
||||||
default:
|
default:
|
||||||
uploadByGithub(reader.result, image.name)
|
uploadByGithub(reader.result, image.name)
|
||||||
|
Loading…
Reference in New Issue
Block a user