From f40ca3d85fd5ce2e5b6170fbb37fe815c28adb8c Mon Sep 17 00:00:00 2001 From: csg01123119 Date: Fri, 12 Jul 2024 14:36:31 +0800 Subject: [PATCH] fix: 403 error details not returned --- lib/client.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/client.js b/lib/client.js index c2b28214..49952964 100644 --- a/lib/client.js +++ b/lib/client.js @@ -7,9 +7,6 @@ const merge = require('merge-descriptors'); const platform = require('platform'); const utility = require('utility'); const urllib = require('urllib'); -const { - Base64: { decode: base64ToStr } -} = require('js-base64'); const pkg = require('../package.json'); const bowser = require('bowser'); const signUtils = require('./common/signUtils'); @@ -381,6 +378,7 @@ proto.requestError = async function requestError(result) { err.status = result.status; err.code = info.Code; err.requestId = info.RequestId; + err.ecCode = info.EC; err.hostId = info.HostId; }; @@ -412,7 +410,7 @@ proto.requestError = async function requestError(result) { err.status = result.status; const ossErr = result.headers['x-oss-err']; if (ossErr) { - const message = base64ToStr(ossErr); + const message = Buffer.from(ossErr, 'base64').toString('utf8'); await setError(message); } err.res = result;