mirror of
https://github.com/doocs/md.git
synced 2024-11-24 19:10:34 +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,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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user