Permalink
Browse files

Need encodeURIComponent instead of encodeURI

We need to use encodeURIComponent instead of encodeURI to account for special characters like '+' in the file name. This is especially so for those that directly upload to s3 from the browser where they have no control over filenames
  • Loading branch information...
1 parent c98e7e0 commit ab6850cc59259e97edc09b35081462d240f7d050 @satb committed Jan 10, 2014
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/client.js
View
@@ -83,7 +83,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 encodeURIComponent(filename).replace(/[!'()* ]/g, function (char) {
return '%' + char.charCodeAt(0).toString(16);
});
}

0 comments on commit ab6850c

Please sign in to comment.