diff --git a/package-lock.json b/package-lock.json index b3c76f3..bfdf3bc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "vue-md", - "version": "1.4.6", + "version": "1.4.7", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 7c5b5cf..fc4bd85 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vue-md", - "version": "1.4.6", + "version": "1.4.7", "homepage": ".", "description": "An open-source wechat markdown editor.", "author": "doocs", diff --git a/src/api/file.js b/src/api/file.js index 4223d4e..48bd83e 100644 --- a/src/api/file.js +++ b/src/api/file.js @@ -161,18 +161,17 @@ async function aliOSSFileUpload(content, filename) { path, } = JSON.parse(localStorage.getItem("aliOSSConfig")); const buffer = Buffer(content, "base64"); + const dir = `${path}/${dateFilename}`; + const client = new OSS({ + region, + bucket, + accessKeyId, + accessKeySecret, + }); try { - const dir = `${path}/${dateFilename}`; - const client = new OSS({ - region, - bucket, - accessKeyId, - accessKeySecret, - }); const res = await client.put(dir, buffer); - return cdnHost == "" - ? res.url - : `${cdnHost}/${path == "" ? dateFilename : dir}`; + if (cdnHost == "") return res.url; + return `${cdnHost}/${path == "" ? dateFilename : dir}`; } catch (e) { return Promise.reject(e); }