From 3d3cd17f24a928ec44f9c2a850e898e7f85b2fa0 Mon Sep 17 00:00:00 2001 From: Xander-C <8166568+xander-c@user.noreply.gitee.com> Date: Wed, 8 Jun 2022 15:23:03 +0800 Subject: [PATCH] Fix picgo and cliScript uploader (marktext#2915) --- src/renderer/util/fileSystem.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/renderer/util/fileSystem.js b/src/renderer/util/fileSystem.js index d2b551373e..1e4b5c9ab8 100644 --- a/src/renderer/util/fileSystem.js +++ b/src/renderer/util/fileSystem.js @@ -149,12 +149,12 @@ export const uploadImage = async (pathname, image, preferences) => { }) } - const uploadByCommand = async (uploader, filepath) => { + const uploadByCommand = async (uploader, filepath, filename) => { 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() + filename) 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, image.name) break default: uploadByGithub(reader.result, image.name)