Skip to content
This repository has been archived by the owner on Oct 3, 2023. It is now read-only.

Commit

Permalink
fix(Automattic#288) space already handled with encodeURI, duped calls…
Browse files Browse the repository at this point in the history
… to encodeSpecialCharacters
  • Loading branch information
James Cunningham committed Aug 10, 2016
1 parent 278337d commit 4dbf1f1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function removeLeadingSlash(filename) {
function encodeSpecialCharacters(filename) {
// Note: these characters are valid in URIs, but S3 does not like them for
// some reason.
return encodeURI(filename).replace(/[!'()#*+? ]/g, function (char) {
return encodeURI(filename).replace(/[!'()#*+?]/g, function (char) {
return '%' + char.charCodeAt(0).toString(16);
});
}
Expand Down Expand Up @@ -823,7 +823,7 @@ Client.prototype.list = function(params, headers, fn){
*/

Client.prototype.http = function(filename){
filename = encodeSpecialCharacters(ensureLeadingSlash(filename));
filename = ensureLeadingSlash(filename);

return 'http://' + this.urlBase + filename;
};
Expand All @@ -837,7 +837,7 @@ Client.prototype.http = function(filename){
*/

Client.prototype.https = function(filename){
filename = encodeSpecialCharacters(ensureLeadingSlash(filename));
filename = ensureLeadingSlash(filename);

return 'https://' + this.urlBase + filename;
};
Expand Down

0 comments on commit 4dbf1f1

Please sign in to comment.