Skip to content

Commit

Permalink
Merge pull request #4 from Xander-C/fix_uploader
Browse files Browse the repository at this point in the history
Fix picgo and cliScript uploader (marktext#2915)
  • Loading branch information
pencilheart committed Jul 19, 2022
2 parents 90e796b + 5775b28 commit b4f6176
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/renderer/util/fileSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit b4f6176

Please sign in to comment.