From 22363d05b6f04d1c4f29e90370f1f5b29a4dc4a1 Mon Sep 17 00:00:00 2001 From: Albert Luo Date: Wed, 13 Jun 2018 16:56:05 +0800 Subject: [PATCH] fix: remove replace %20 to '+' (#489) * fix: remove replace %20 to '+' * fix : eslint --- lib/browser/client.js | 4 ++-- lib/client.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/browser/client.js b/lib/browser/client.js index a5d4bb88d..5dadc12d5 100644 --- a/lib/browser/client.js +++ b/lib/browser/client.js @@ -365,7 +365,7 @@ proto._getReqUrl = function _getReqUrl(params) { if (params.object) { // Preserve '/' in result url - reourcePath += this._escape(params.object); + reourcePath += this._escape(params.object).replace(/\+/g, '%2B'); } ep.pathname = reourcePath; @@ -391,7 +391,7 @@ proto._getReqUrl = function _getReqUrl(params) { ep.query = query; // As '%20' is not recognized by OSS server, we must convert it to '+'. - return urlutil.format(ep).replace(/%20/g, '+'); + return urlutil.format(ep); }; /* diff --git a/lib/client.js b/lib/client.js index 560aa413d..4dc2e47be 100644 --- a/lib/client.js +++ b/lib/client.js @@ -352,7 +352,7 @@ proto._getReqUrl = function _getReqUrl(params) { if (params.object) { // Preserve '/' in result url - resourcePath += this._escape(params.object); + resourcePath += this._escape(params.object).replace(/\+/g, '%2B'); } ep.pathname = resourcePath; @@ -378,7 +378,7 @@ proto._getReqUrl = function _getReqUrl(params) { ep.query = query; // As '%20' is not recognized by OSS server, we must convert it to '+'. - return urlutil.format(ep).replace(/%20/g, '+'); + return urlutil.format(ep); }; /*