Fixed: imgList error

This commit is contained in:
Molunerfinn 2018-01-16 17:05:33 +08:00
parent f657026820
commit 7364ea6ddf

View File

@ -44,6 +44,7 @@ const weiboUpload = async function (img, type, webContents) {
} }
webContents.send('uploadProgress', 60) webContents.send('uploadProgress', 60)
const imgList = await img2Base64[type](img) const imgList = await img2Base64[type](img)
for (let i in imgList) {
let opt = { let opt = {
formData: { formData: {
b64_data: imgList[i].base64Image b64_data: imgList[i].base64Image
@ -54,7 +55,6 @@ const weiboUpload = async function (img, type, webContents) {
Cookie: cookie Cookie: cookie
} }
} }
for (let i in imgList) {
let result = await rp.post(UPLOAD_URL, opt) let result = await rp.post(UPLOAD_URL, opt)
result = result.replace(/<.*?\/>/, '').replace(/<(\w+).*?>.*?<\/\1>/, '') result = result.replace(/<.*?\/>/, '').replace(/<(\w+).*?>.*?<\/\1>/, '')
delete imgList[i].base64Image delete imgList[i].base64Image