From 59eb85cecc1aea83de60ac9557315c05e6e57ecc Mon Sep 17 00:00:00 2001 From: Lunan Li Date: Mon, 13 Sep 2021 20:36:52 -0700 Subject: [PATCH] Better Error Handling during Upload Failure and Setting Max File Length to Infinity --- plugins/songUpload.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/songUpload.js b/plugins/songUpload.js index d94d8f45d51..d799096c35d 100644 --- a/plugins/songUpload.js +++ b/plugins/songUpload.js @@ -17,11 +17,10 @@ module.exports = async (query, request) => { ) // 上传 - const objectKey = tokenRes.body.result.objectKey.replace('/', '%2F') try { await axios({ method: 'post', - url: `http://45.127.129.8/jd-musicrep-privatecloud-audio-public/${objectKey}?offset=0&complete=true&version=1.0`, + url: tokenRes.body.result.outerUrl, headers: { 'x-nos-token': tokenRes.body.result.token, 'Content-MD5': query.songFile.md5, @@ -29,9 +28,12 @@ module.exports = async (query, request) => { 'Content-Length': String(query.songFile.size), }, data: query.songFile.data, + maxContentLength: Infinity, + maxBodyLength: Infinity, }) } catch (error) { console.log('error', error.response) + throw error.response } return { ...tokenRes,