From ce417911d7ca5c5dc11548b61ea2984d47bd4f08 Mon Sep 17 00:00:00 2001 From: taevas Date: Mon, 15 Jul 2019 11:54:29 +0800 Subject: [PATCH] =?UTF-8?q?:sparkles:=20=E6=B5=8F=E8=A7=88=E5=99=A8?= =?UTF-8?q?=E7=AB=AF=E4=B9=9F=E6=94=AF=E6=8C=81=20basename?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- upyun/browser-form-upload.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/upyun/browser-form-upload.js b/upyun/browser-form-upload.js index 9f6d2b8..445f973 100644 --- a/upyun/browser-form-upload.js +++ b/upyun/browser-form-upload.js @@ -1,4 +1,5 @@ import axios from 'axios' +import path from 'path' export default function formUpload (remoteUrl, localFile, {authorization, policy}, {filename} = {}) { const data = new FormData() @@ -8,6 +9,7 @@ export default function formUpload (remoteUrl, localFile, {authorization, policy localFile = new Blob([localFile], {type: 'text/plain'}) } + filename = filename ? path.basename(filename) : filename data.append('file', localFile, filename) return axios.post(remoteUrl, data).then(({status, data}) => { if (status === 200) {