From e3ff30262d3e981a8375adf8c9327ead48ceda5b Mon Sep 17 00:00:00 2001 From: "fish.yu" Date: Thu, 18 Apr 2024 01:07:21 +0800 Subject: [PATCH] feat: set encode false --- lib/download.js | 2 +- lib/github.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/download.js b/lib/download.js index fa0fc27..c031a13 100644 --- a/lib/download.js +++ b/lib/download.js @@ -136,7 +136,7 @@ class Downloader { const content = await downloadImage(cover); const imageName = crypto.randomUUID() + '.' + cover.split('.').pop(); const imageUrl = `_images/${imageName}`; - await gh.writeFile(imageUrl, content) + await gh.writeFile(imageUrl, content, { encode: false }) mdBody = `![${title}](${cover})` } const content = decoratePost(title, mdBody, `https://www.yuque.com/${client.namespace}/${slug}`) diff --git a/lib/github.js b/lib/github.js index 4c98885..9299d0e 100644 --- a/lib/github.js +++ b/lib/github.js @@ -32,10 +32,10 @@ class GitHubClient extends GitHub { return res; } - async writeFile (name, content ) { + async writeFile (name, content, options ) { let res; try { - const { data } = await this.repo.writeFile('master', name, content, `update file ${name}`) + const { data } = await this.repo.writeFile('master', name, content, `update file ${name}`, options) res = { status: true, data } } catch (error) { res = handler(error.response || { message: error.message })