This commit is contained in:
Xander-C 2024-06-12 22:27:59 +00:00 committed by GitHub
commit 93460f2368
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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
if (typeof filepath !== 'string') {
isPath = false
const data = new Uint8Array(filepath)
filepath = path.join(tmpdir(), +new Date())
filepath = path.join(tmpdir(), +new Date() + suffix)
await fs.writeFile(filepath, data)
}
if (uploader === 'picgo') {
@ -224,7 +224,7 @@ export const uploadImage = async (pathname, image, preferences) => {
switch (currentUploader) {
case 'picgo':
case 'cliScript':
uploadByCommand(currentUploader, reader.result)
uploadByCommand(currentUploader, reader.result, path.extname(image.name))
break
default:
uploadByGithub(reader.result, image.name)