mirror of
https://github.com/doocs/md.git
synced 2024-11-28 13:36:32 +08:00
feat: update file api
This commit is contained in:
parent
2648c03b97
commit
36dfd1ae02
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "vue-md",
|
||||
"version": "1.4.6",
|
||||
"version": "1.4.7",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
@ -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",
|
||||
|
@ -161,7 +161,6 @@ async function aliOSSFileUpload(content, filename) {
|
||||
path,
|
||||
} = JSON.parse(localStorage.getItem("aliOSSConfig"));
|
||||
const buffer = Buffer(content, "base64");
|
||||
try {
|
||||
const dir = `${path}/${dateFilename}`;
|
||||
const client = new OSS({
|
||||
region,
|
||||
@ -169,10 +168,10 @@ async function aliOSSFileUpload(content, filename) {
|
||||
accessKeyId,
|
||||
accessKeySecret,
|
||||
});
|
||||
try {
|
||||
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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user